Read() private method

private Read ( byte buffer, int count ) : int
buffer byte
count int
return int
Example #1
0
        public ScriptFormula(MpqFileStream stream)
        {
            this.I0 = stream.ReadValueS32();
            this.I1 = stream.ReadValueS32();
            this.I2 = stream.ReadValueS32();
            this.I3 = stream.ReadValueS32();
            this.I4 = stream.ReadValueS32();
            this.NameSize = stream.ReadValueS32();
            this.I5 = stream.ReadValueS32();
            this.OpcodeSize = stream.ReadValueS32();
            this.OpCodeName = new byte[NameSize];
            stream.Read(OpCodeName, 0, NameSize);
            switch(NameSize % 4)
            {
                case 0:
                    break;
                case 1:
                    stream.Position += 3;
                    break;
                case 2:
                    stream.Position += 2;
                    break;
                case 3:
                    stream.Position += 1;
                    break;

            }
            this.OpCodeArray = new byte[OpcodeSize];
            stream.Read(OpCodeArray, 0, OpcodeSize);
        }
Example #2
0
 /// <summary>
 /// Reads RGBAColor from given MPQFileStream.
 /// </summary>
 /// <param name="stream">The MPQFileStream to read from.</param>
 public RGBAColor(MpqFileStream stream)
 {
     var buf = new byte[4];
     stream.Read(buf, 0, 4);
     Red = buf[0];
     Green = buf[1];
     Blue = buf[2];
     Alpha = buf[3];
 }
Example #3
0
 public void Read(MpqFileStream stream)
 {
     c0 = new char[256];
     c1 = new char[512];
     byte[] buf = new byte[512];
     stream.Read(buf, 0, 256);
     for (int i = 0; i < c0.Length; i++)
     {
         c0[i] = (char)buf[i];
     }
     stream.Read(buf, 0, 512);
     for (int i = 0; i < c1.Length; i++)
     {
         c1[i] = (char)buf[i];
     }
     i0 = stream.ReadValueS32();
     i1 = stream.ReadValueS32();
 }
Example #4
0
            public WeightedLook(MpqFileStream stream)
            {
                byte[] buf = new byte[64];                
                stream.Read(buf, 0, 64); LookLink = Encoding.ASCII.GetString(buf);
                i0 = stream.ReadInt32();

            }
Example #5
0
		   public Marker(MpqFileStream stream)
		   {
			   byte[] buf = new byte[128];
			   stream.Read(buf, 0, 128); Name = Encoding.ASCII.GetString(buf);
			   i0 = stream.ReadInt32();
			   PRTransform = new PRTransform(stream);
			   SNOName = new SNOName(stream);
			   serTagMap = new SerializeData(stream);
			   TagMap = stream.ReadInt32();
			   i1 = stream.ReadInt32();
			   i2 = stream.ReadInt32();
			   serMarkerLinks = new SerializeData(stream);
			   stream.Position += (3 * 4);
			   long x = stream.Position;
			   
			   if (serTagMap.Size > 0)
			   {
				   stream.Position = serTagMap.Offset + 16;
				   TM = new TagMap(stream);

			   }
			   stream.Position = x;
		   }