/// <summary> /// Compiles a script. /// </summary> public static void CompileScript(Record r2, out string msg) { try { ((FalloutCSharpScriptFunctionProxy)Functions).CompileScript(r2, out msg); r2.SubRecords.Clear(); for (int i = 0; i < r2.SubRecords.Count; i++) r2.SubRecords.Add((SubRecord)r2.SubRecords[i].Clone()); } catch (Exception e) { LastError = e.Message; msg = null; } }
/// <summary> /// Compiles the result script. /// </summary> public static void CompileResultScript(SubRecord sr, out Record r2, out string msg) { Record r; try { ((FalloutCSharpScriptFunctionProxy)Functions).CompileResultScript(sr, out r, out msg); } catch (Exception e) { LastError = e.Message; r = null; msg = null; } if (r != null) r2 = (Record)r.Clone(); else r2 = null; }
/// <summary> /// A simple constructor that initializes the object with the given values. /// </summary> /// <param name="Size">The size of the groop record.</param> /// <param name="br">The reader caontaining the group record data.</param> /// <param name="Oblivion">Whether the record is in Oblivion format.</param> internal GroupRecord(uint Size, BinaryReader br, bool Oblivion) { Name = "GRUP"; data = br.ReadBytes(4); groupType = br.ReadUInt32(); dateStamp = br.ReadUInt32(); if (!Oblivion) flags = br.ReadUInt32(); uint AmountRead = 0; while (AmountRead < Size - (Oblivion ? 20 : 24)) { string s = TesPlugin.ReadRecName(br); uint recsize = br.ReadUInt32(); if (s == "GRUP") { GroupRecord gr = new GroupRecord(recsize, br, Oblivion); AmountRead += recsize; Records.Add(gr); } else { Record r = new Record(s, recsize, br, Oblivion); AmountRead += (uint)(recsize + (Oblivion ? 20 : 24)); Records.Add(r); } } if (AmountRead > (Size - (Oblivion ? 20 : 24))) { throw new TESParserException("Record block did not match the size specified in the group header"); } if (groupType == 0) { descriptiveName = " (" + (char)data[0] + (char)data[1] + (char)data[2] + (char)data[3] + ")"; } }
/// <summary> /// The copy constructor. /// </summary> /// <param name="r">The record to copy.</param> private Record(Record r) { SubRecords = new List<SubRecord>(r.SubRecords.Count); for (int i = 0; i < r.SubRecords.Count; i++) SubRecords.Add((SubRecord)r.SubRecords[i].Clone()); Flags1 = r.Flags1; Flags2 = r.Flags2; Flags3 = r.Flags3; FormID = r.FormID; Name = r.Name; descriptiveName = r.descriptiveName; }
/// <summary> /// Compiles a script. /// </summary> public void CompileScript(Record r2, out string msg) { ScriptCompiler.Compile(r2, out msg); }
/// <summary> /// Compiles the result script. /// </summary> public void CompileResultScript(SubRecord sr, out Record r2, out string msg) { ScriptCompiler.CompileResultScript(sr, out r2, out msg); }