Encapsulates insteracting with sub-records.
Наследование: BaseRecord
		/// <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;
		}
Пример #2
0
        /// <summary>
        /// A simple constructor that initializes the object with the given values.
        /// </summary>
        /// <param name="name">The name of the record.</param>
        /// <param name="br">The reader containing the record data.</param>
        internal Record(string name, BinaryReader br)
        {
            Name = name;
            br.BaseStream.Position += 12;
            uint AmountRead = 0;

            string s = ReadRecName(br);
            if (s == "HEDR")
            {
                br.BaseStream.Position += 10;
                SubRecord r = new SubRecord("CNAM", br, 32);
                AmountRead += (uint)(r.Size2);
                SubRecords.Add(r);
                br.BaseStream.Position -= 2;
                r = new SubRecord("SNAM", br, 256);
                AmountRead += (uint)(r.Size2);
                SubRecords.Add(r);
                br.BaseStream.Position += 4;
                s = ReadRecName(br);
                while (s == "MAST")
                {
                    r = new SubRecord(s, br, br.ReadUInt16());
                    SubRecords.Add(r);
                    br.BaseStream.Position += 16;
                    s = ReadRecName(br);
                }
            }
        }
Пример #3
0
		/// <summary>
		/// The copy constructor.
		/// </summary>
		/// <param name="sr">The sub-record to copy.</param>
		private SubRecord(SubRecord sr)
		{
			Name = sr.Name;
			Data = (byte[])sr.Data.Clone();
		}
Пример #4
0
		/// <summary>
		/// A simple constructor that initializes the object with the given values.
		/// </summary>
		/// <param name="name">The name of the record.</param>
		/// <param name="Size">The size of the record.</param>
		/// <param name="br">The reader containing the record data.</param>
		/// <param name="Oblivion">Whether the recrod is in Oblivion format.</param>
		internal Record(string name, uint Size, BinaryReader br, bool Oblivion)
		{
			Name = name;
			Flags1 = br.ReadUInt32();
			FormID = br.ReadUInt32();
			Flags2 = br.ReadUInt32();
			if (!Oblivion) Flags3 = br.ReadUInt32();
			if ((Flags1 & 0x00040000) > 0)
			{
				Flags1 ^= 0x00040000;
				uint newSize = br.ReadUInt32();
				br = Decompress(br, (int)(Size - 4), (int)newSize);
				Size = newSize;
			}
			uint AmountRead = 0;
			while (AmountRead < Size)
			{
				string s = ReadRecName(br);
				uint i = 0;
				if (s == "XXXX")
				{
					br.ReadUInt16();
					i = br.ReadUInt32();
					s = ReadRecName(br);
				}
				SubRecord r = new SubRecord(s, br, i);
				AmountRead += (uint)(r.Size2);
				SubRecords.Add(r);
			}
			if (AmountRead > Size)
			{
				throw new TESParserException("Subrecord block did not match the size specified in the record header");
			}

			//br.BaseStream.Position+=Size;
			if (SubRecords.Count > 0 && SubRecords[0].Name == "EDID") descriptiveName = " (" + SubRecords[0].GetStrData() + ")";
		}
		/// <summary>
		/// Compiles the result script.
		/// </summary>
		public void CompileResultScript(SubRecord sr, out Record r2, out string msg)
		{
			ScriptCompiler.CompileResultScript(sr, out r2, out msg);
		}