Exemple #1
0
 public void method_1(string string_0)
 {
     using (Stream26 stream = new Stream26(File.Create(string_0 + "\\s000.d")))
     {
         this.vmethod_1(stream);
         stream.WriteByte2(0);
         using (Stream26 stream2 = new Stream26(File.Create(string_0 + "\\toc.dat")))
         {
             stream2.WriteInt(0);
             stream2.WriteByte2(4);
             stream2.WriteByte2(0);
             stream2.WriteByte2(0);
             stream2.WriteByte2(0);
             stream2.WriteUInt(3724414393u);
             stream2.WriteString("GH3Progress");
             stream2.WriteNBytes(0, 7);
             stream2.WriteByte2(48);
             stream2.WriteByte2(0);
             stream2.WriteInt((int)stream.Length);
             stream.Position = 0L;
             stream2.WriteInt(KeyGenerator.GetQbKey(stream, true));
             stream2.WriteNBytes(0, 40);
             stream2.WriteByte2(Convert.ToByte(DateTime.Now.Minute));
             stream2.WriteByte2(0);
             stream2.WriteShort((short)DateTime.Now.Year);
             stream2.WriteByte2(Convert.ToByte(DateTime.Now.Second));
             stream2.WriteByte2(Convert.ToByte(DateTime.Now.Month - 1));
             stream2.WriteByte2(Convert.ToByte(DateTime.Now.Day));
             stream2.WriteByte2(Convert.ToByte(DateTime.Now.Hour));
             stream2.WriteNBytes(0, 15120);
             stream2.WriteInt(756937245);
             stream2.WriteNBytes(0, 12);
             stream2.Position = 4L;
             int num = KeyGenerator.GetQbKey(stream2, true);
             stream2.Position = 0L;
             stream2.WriteInt(num);
             stream.Position = stream.Length;
             stream.WriteNBytes(0, 5242880 - (int)stream.Length);
         }
     }
 }
Exemple #2
0
        public Stream26 ToStream()
        {
            Stream26 stream = new Stream26(true);
            int textureCount = this.TextureCount();
            int textureMetaDataOffset = 0;
            if (!this._unkFlag0)
            {
                stream.WriteUInt(0xFACECAA7); //meow
                stream.WriteShort(284);
                stream.WriteShort((short)textureCount);
                stream.WriteInt(0);
                stream.WriteInt(0);
                stream.WriteInt(-1);

                int num3 = 2;
                while ((double)textureCount / Math.Pow(2.0, (double)(num3 - 2)) > 1.0)
                {
                    num3++;
                }
                num3--;
                stream.WriteInt(num3); //logarithm of textureCount?..
                stream.WriteInt(28);
                stream.WriteNBytes(0xEF, (int)(Math.Pow(2.0, (double)num3) * 12.0 + 28.0));

                textureMetaDataOffset = (int)stream.Position;
                stream.WriteIntAt(8, textureMetaDataOffset);
                stream.WriteInt(textureMetaDataOffset + textureCount * 44);
                stream.Position = (long)textureMetaDataOffset;
            }
            stream.WriteNBytes(0, 40 * textureCount);
            for (int i = 0; i < textureCount; i++)
            {
                TextureMetadata tex = this.textureList[i];
                byte[] array = this.method_2(i);
                stream.WriteShortAt(textureMetaDataOffset + 40 * i, 2600);
                stream.WriteShort(tex.unkShort0);
                stream.WriteInt(tex.unkInt);
                stream.WriteShort(tex.Width);
                stream.WriteShort(tex.Height);
                stream.WriteShort(tex.unkShort3);
                stream.WriteShort(tex.Width);
                stream.WriteShort(tex.Height);
                stream.WriteShort(tex.unkShort3);
                stream.WriteByte2(tex.MipMapCount);
                stream.WriteShort(tex.unkShort4);
                stream.WriteNBytes(0, 5);
                stream.WriteInt((int)stream.Length);
                stream.WriteInt(array.Length);
                stream.WriteInt(0);
                stream.WriteByteArrayAt((int)stream.Length, array, false);
            }
            return stream;
        }
 public override void vmethod_1(Stream26 stream26_0)
 {
     stream26_0.WriteByte2(this.byte_0);
     stream26_0.WriteInt(this.int_0[0]);
     byte byte_ = this.byte_0;
     switch (byte_)
     {
     case 1:
         stream26_0.WriteInt((int)this.object_0);
         return;
     case 2:
         stream26_0.WriteFloat((float)this.object_0);
         return;
     case 3:
         break;
     case 4:
         stream26_0.WriteString((string)this.object_0, false);
         stream26_0.WriteByte2(0);
         stream26_0.WriteByte2(0);
         return;
     default:
         switch (byte_)
         {
         case 13:
             stream26_0.WriteInt(this.int_0[1]);
             return;
         case 14:
         case 16:
             stream26_0.WriteByte2((byte)this.object_0);
             return;
         case 15:
             break;
         case 17:
             stream26_0.WriteShort((short)this.object_0);
             break;
         default:
             return;
         }
         break;
     }
 }