コード例 #1
0
 protected override void ReadData(ESPReader reader)
 {
     using (MemoryStream stream = new MemoryStream(reader.ReadBytes(size)))
         using (ESPReader subReader = new ESPReader(stream, reader.Plugin))
         {
             try
             {
                 MinAttenuationDistance        = subReader.ReadByte();
                 MaxAttenuationDistance        = subReader.ReadByte();
                 FrequencyAdjustmentPercentage = subReader.ReadSByte();
                 Unused                   = subReader.ReadByte();
                 SoundDataFlags           = subReader.ReadEnum <SoundDataFlags>();
                 StaticAttenuationcdB     = subReader.ReadInt16();
                 StopTime                 = subReader.ReadByte();
                 StartTime                = subReader.ReadByte();
                 AttenuationCurvePoint1   = subReader.ReadInt16();
                 AttenuationCurvePoint2   = subReader.ReadInt16();
                 AttenuationCurvePoint3   = subReader.ReadInt16();
                 AttenuationCurvePoint4   = subReader.ReadInt16();
                 AttenuationCurvePoint5   = subReader.ReadInt16();
                 ReverbAttenuationControl = subReader.ReadInt16();
                 Priority                 = subReader.ReadInt32();
                 Unknown                  = subReader.ReadBytes(8);
             }
             catch
             {
                 return;
             }
         }
 }
コード例 #2
0
 protected override void ReadData(ESPReader reader)
 {
     using (MemoryStream stream = new MemoryStream(reader.ReadBytes(size)))
         using (ESPReader subReader = new ESPReader(stream, reader.Plugin))
         {
             try
             {
                 Month     = subReader.ReadSByte();
                 DayOfWeek = subReader.ReadEnum <PackageScheduleDays>();
                 Date      = subReader.ReadByte();
                 Time      = subReader.ReadSByte();
                 Duration  = subReader.ReadInt32();
             }
             catch
             {
                 return;
             }
         }
 }
コード例 #3
0
        protected override void ReadData(ESPReader reader)
        {
            Type tType    = typeof(T);
            Type readType = tType;

            if (tType.IsEnum)
            {
                readType = Enum.GetUnderlyingType(tType);
            }

            string typeName = readType.FullName;


            switch (typeName)
            {
            case "System.Byte":
                //Debug.Assert(size == 1);
                Value = (T)(object)reader.ReadByte();
                break;

            case "System.SByte":
                Debug.Assert(size == 1);
                Value = (T)(object)reader.ReadSByte();
                break;

            case "System.Char":
                Debug.Assert(size == 1);
                Value = (T)(object)reader.ReadChar();
                break;

            case "System.UInt16":
                Debug.Assert(size == 2);
                Value = (T)(object)reader.ReadUInt16();
                break;

            case "System.Int16":
                Debug.Assert(size == 2);
                Value = (T)(object)reader.ReadInt16();
                break;

            case "System.UInt32":
                Debug.Assert(size == 4);
                Value = (T)(object)reader.ReadUInt32();
                break;

            case "System.Int32":
                Debug.Assert(size == 4);
                Value = (T)(object)reader.ReadInt32();
                break;

            case "System.Single":
                Debug.Assert(size == 4);
                Value = (T)(object)reader.ReadSingle();
                break;

            case "System.UInt64":
                Debug.Assert(size == 8);
                Value = (T)(object)reader.ReadUInt64();
                break;

            case "System.Int64":
                Debug.Assert(size == 8);
                Value = (T)(object)reader.ReadInt64();
                break;

            case "System.Byte[]":
                Value = (T)(object)reader.ReadBytes(size);
                break;

            case "System.Char[]":
                string tempstring = new string(reader.ReadChars(size));
                tempstring = tempstring.Replace("\0", "");
                Value      = (T)(object)tempstring.ToCharArray();
                break;

            case "System.String":
                string outString = new String(reader.ReadChars(size - 1));
                reader.ReadByte();
                Value = (T)(object)(outString.Replace("\0", ""));
                break;

            case "ESPSharp.DataTypes.Color":
                var color = new DataTypes.Color();
                color.ReadBinary(reader);
                Value = (T)(object)color;
                break;

            case "ESPSharp.DataTypes.XYFloat":
                var temp = new DataTypes.XYFloat();
                temp.ReadBinary(reader);
                Value = (T)(object)temp;
                break;

            default:
                throw new NotImplementedException(typeName + " is not yet implemented.");
            }
        }