set => this.SetValue(HeaderProperty, value);
 set => SetValue(HeaderProperty, value);
Exemplo n.º 3
0
        public static void ReadSubStreamsInfo(BinaryReader br, ref Folder[] Folders)
        {
            for (; ;)
            {
                HeaderProperty hp = (HeaderProperty)br.ReadByte();
                switch (hp)
                {
                case HeaderProperty.kNumUnPackStream:
                {
                    for (int f = 0; f < Folders.Length; f++)
                    {
                        int numStreams = (int)br.ReadEncodedUInt64();
                        Folders[f].UnpackedStreamInfo = new UnpackedStreamInfo[numStreams];
                        for (int i = 0; i < numStreams; i++)
                        {
                            Folders[f].UnpackedStreamInfo[i] = new UnpackedStreamInfo();
                        }
                    }

                    continue;
                }

                case HeaderProperty.kSize:
                {
                    for (int f = 0; f < Folders.Length; f++)
                    {
                        Folder folder = Folders[f];

                        if (folder.UnpackedStreamInfo.Length == 0)
                        {
                            continue;
                        }

                        ulong sum = 0;
                        for (int i = 0; i < folder.UnpackedStreamInfo.Length - 1; i++)
                        {
                            ulong size = br.ReadEncodedUInt64();
                            folder.UnpackedStreamInfo[i].UnpackedSize = size;
                            sum += size;
                        }

                        folder.UnpackedStreamInfo[folder.UnpackedStreamInfo.Length - 1].UnpackedSize =
                            folder.GetUnpackSize() - sum;
                    }

                    continue;
                }

                case HeaderProperty.kCRC:
                {
                    ulong numCRC = 0;
                    foreach (Folder folder in Folders)
                    {
                        if (folder.UnpackedStreamInfo == null)
                        {
                            folder.UnpackedStreamInfo    = new UnpackedStreamInfo[1];
                            folder.UnpackedStreamInfo[0] = new UnpackedStreamInfo();
                            folder.UnpackedStreamInfo[0].UnpackedSize = folder.GetUnpackSize();
                        }

                        if ((folder.UnpackedStreamInfo.Length != 1) || !folder.UnpackCRC.HasValue)
                        {
                            numCRC += (ulong)folder.UnpackedStreamInfo.Length;
                        }
                    }

                    int     crcIndex = 0;
                    uint?[] crc;
                    Util.UnPackCRCs(br, numCRC, out crc);
                    for (uint i = 0; i < Folders.Length; i++)
                    {
                        Folder folder = Folders[i];
                        if ((folder.UnpackedStreamInfo.Length == 1) && folder.UnpackCRC.HasValue)
                        {
                            folder.UnpackedStreamInfo[0].Crc = folder.UnpackCRC;
                        }
                        else
                        {
                            for (uint j = 0; j < folder.UnpackedStreamInfo.Length; j++, crcIndex++)
                            {
                                folder.UnpackedStreamInfo[j].Crc = crc[crcIndex];
                            }
                        }
                    }

                    continue;
                }

                case HeaderProperty.kEnd:
                    return;

                default:
                    throw new Exception(hp.ToString());
                }
            }
        }
Exemplo n.º 4
0
        public void Read(BinaryReader br)
        {
            ulong size = br.ReadEncodedUInt64();

            Names = new string[size];

            ulong numEmptyFiles = 0;

            for (;;)
            {
                HeaderProperty hp = (HeaderProperty)br.ReadByte();
                if (hp == HeaderProperty.kEnd)
                {
                    return;
                }

                ulong bytessize = br.ReadEncodedUInt64();
                switch (hp)
                {
                case HeaderProperty.kName:
                    if (br.ReadByte() != 0)
                    {
                        throw new Exception("Cannot be external");
                    }

                    for (ulong i = 0; i < size; i++)
                    {
                        Names[i] = br.ReadName();
                    }

                    continue;

                case HeaderProperty.kEmptyStream:
                    EmptyStreamFlags = Util.ReadBoolFlags(br, (ulong)Names.Length);
                    for (ulong i = 0; i < size; i++)
                    {
                        if (EmptyStreamFlags[i])
                        {
                            numEmptyFiles++;
                        }
                    }
                    continue;

                case HeaderProperty.kEmptyFile:
                    EmptyFileFlags = Util.ReadBoolFlags(br, numEmptyFiles);
                    continue;

                case HeaderProperty.kWinAttributes:
                    Attributes = Util.ReadUInt32Def(br, size);
                    continue;

                // don't know what this is.
                case HeaderProperty.kAnti:
                    br.ReadBytes((int)bytessize);
                    continue;

                case HeaderProperty.kCreationTime:
                case HeaderProperty.kLastAccessTime:
                case HeaderProperty.kLastWriteTime:
                    br.ReadBytes((int)bytessize);
                    continue;

                case HeaderProperty.kDummy:
                    br.ReadBytes((int)bytessize);
                    continue;

                default:
                    throw new Exception(hp.ToString());
                }
            }
        }
Exemplo n.º 5
0
        public static void ReadUnPackInfo(BinaryReader br, out Folder[] Folders)
        {
            Folders = null;
            for (; ;)
            {
                HeaderProperty hp = (HeaderProperty)br.ReadByte();
                switch (hp)
                {
                case HeaderProperty.kFolder:
                {
                    ulong numFolders = br.ReadEncodedUInt64();

                    Folders = new Folder[numFolders];

                    byte external = br.ReadByte();
                    switch (external)
                    {
                    case 0:
                    {
                        ulong folderIndex = 0;
                        for (uint i = 0; i < numFolders; i++)
                        {
                            Folders[i] = new Folder();
                            Folders[i].ReadFolder(br);
                            Folders[i].PackedStreamIndexBase = folderIndex;
                            folderIndex += (ulong)Folders[i].PackedStreamIndices.Length;
                        }

                        break;
                    }

                    case 1:
                        throw new NotSupportedException("External flag");
                    }

                    continue;
                }


                case HeaderProperty.kCodersUnPackSize:
                {
                    for (uint i = 0; i < Folders.Length; i++)
                    {
                        Folders[i].ReadUnpackedStreamSize(br);
                    }

                    continue;
                }

                case HeaderProperty.kCRC:
                {
                    uint?[] crcs;
                    Util.UnPackCRCs(br, (ulong)Folders.Length, out crcs);
                    for (int i = 0; i < Folders.Length; i++)
                    {
                        Folders[i].UnpackCRC = crcs[i];
                    }

                    continue;
                }

                case HeaderProperty.kEnd:
                    return;

                default:
                    throw new Exception(hp.ToString());
                }
            }
        }
Exemplo n.º 6
0
 get => (string)GetValue(HeaderProperty); set => SetValue(HeaderProperty, value);
Exemplo n.º 7
0
        /// <summary>
        /// Static constructor
        /// </summary>
        static RibbonTitleBar()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(RibbonTitleBar), new FrameworkPropertyMetadata(typeof(RibbonTitleBar)));

            HeaderProperty.OverrideMetadata(typeof(RibbonTitleBar), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsArrange | FrameworkPropertyMetadataOptions.AffectsMeasure));
        }
Exemplo n.º 8
0
 set { SetValue(HeaderProperty, value); }
Exemplo n.º 9
0
 set => SetCurrentValue(HeaderProperty, value);