コード例 #1
0
ファイル: Dq3dsDat.cs プロジェクト: caleb-mabry/Kuriimu2
        private byte[] DetermineKey(Stream input)
        {
            foreach (var key in Keys)
            {
                using var xorStream = new XorStream(input, key)
                      {
                          Position = 2
                      };
                var value = xorStream.ReadByte();

                if (value == 0)
                {
                    return(key);
                }
            }

            return(null);
        }
コード例 #2
0
        // ---- CONSTRUCTORS & DESTRUCTOR ------------------------------------------------------------------------------

        internal CircuitInfo(Stream stream)
        {
            XorStream xorStream = new XorStream(stream, _key);

            Name        = xorStream.ReadFixedString(_maxNameLength);
            DisplayName = xorStream.ReadFixedString(_maxDisplayNameLength);
            ImageFile1  = xorStream.ReadFixedString(_maxImageFile1Length);
            ImageFile2  = xorStream.ReadFixedString(_maxImageFile2Length);
            ImageFile3  = xorStream.ReadFixedString(_maxImageFile3Length);
            Flags       = (CircuitFlags)xorStream.ReadByte();
            Version     = (byte)xorStream.ReadByte();
            ID          = (byte)xorStream.ReadByte();
            byte alignment1 = (byte)xorStream.ReadByte();

            Length = xorStream.ReadInt32();
            Laps   = (byte)xorStream.ReadByte();
            Level  = (byte)xorStream.ReadByte();
            ushort alignment2 = xorStream.ReadUInt16();
            uint   runtime    = xorStream.ReadUInt32();
        }