public ServiceDescriptionTable(byte[] data, int offset)
        {
            _Descs = new List <DescriptorBase>();

            int i   = 0;
            int tmp = 0;

            _Sid  = data[(i++) + offset] << 8;
            _Sid |= data[(i++) + offset];

            tmp = data[(i++) + offset];

            _EitSched = (tmp & 0x02) != 0;

            _EitPresentFollowing = (tmp & 0x01) != 0;

            _Len  = data[(i++) + offset] << 8;
            _Len |= data[(i++) + offset];

            _RunningStatus = _Len >> 13;
            _FreeCA        = (_Len & 0x1000) != 0;

            _Len &= 0x0fff;

            while (i < Length)
            {
                DescriptorBase desc = DescriptorFactory.CreateDescriptor(data, i + offset);
                _Descs.Add(desc);

                i += desc.Length;
            }
        }
        public async Task PushArtifactAsync(Configuration.RootConfiguration configuration, OciArtifactModuleReference moduleReference, StreamDescriptor config, params StreamDescriptor[] layers)
        {
            // TODO: How do we choose this? Does it ever change?
            var algorithmIdentifier = DescriptorFactory.AlgorithmIdentifierSha256;

            var blobClient = this.CreateBlobClient(configuration, moduleReference);

            config.ResetStream();
            var configDescriptor = DescriptorFactory.CreateDescriptor(algorithmIdentifier, config);

            config.ResetStream();
            var configUploadResult = await blobClient.UploadBlobAsync(config.Stream);

            var layerDescriptors = new List <OciDescriptor>(layers.Length);

            foreach (var layer in layers)
            {
                layer.ResetStream();
                var layerDescriptor = DescriptorFactory.CreateDescriptor(algorithmIdentifier, layer);
                layerDescriptors.Add(layerDescriptor);

                layer.ResetStream();
                var layerUploadResult = await blobClient.UploadBlobAsync(layer.Stream);
            }

            var manifest = new OciManifest(2, configDescriptor, layerDescriptors);

            using var manifestStream = new MemoryStream();
            OciSerialization.Serialize(manifestStream, manifest);

            manifestStream.Position = 0;
            // BUG: the client closes the stream :( (is it still the case?)
            var manifestUploadResult = await blobClient.UploadManifestAsync(manifestStream, new UploadManifestOptions { Tag = moduleReference.Tag });
        }
Esempio n. 3
0
        private void Parse()
        {
            _Descs.Clear();

            int len = SectionSize - 4; // 4 byte CRC am Ende abziehen.
            int i   = 8;               // start der Daten.

            while (i < len)
            {
                DescriptorBase desc = DescriptorFactory.CreateDescriptor(SectionData, i);

                _Descs.Add(desc);

                i += desc.Length;
            }
        }
Esempio n. 4
0
        public ElementaryStream(byte[] data, int offset)
        {
            _Descs = new List <DescriptorBase>();

            int i = 0;

            _Type = data[(i++) + offset];
            _Pid  = data[(i++) + offset] << 8;
            _Pid |= data[(i++) + offset];
            _Pid &= 0x1fff;

            _Len = data[(i++) + offset] << 8;
            _Len = data[(i++) + offset];

            while (i < Length)
            {
                DescriptorBase desc = DescriptorFactory.CreateDescriptor(data, i + offset);
                _Descs.Add(desc);

                i += desc.Length;
            }
        }
Esempio n. 5
0
        private void Parse()
        {
            // ISO IEC 13818 seite 58 (pdf)

            _Descs.Clear();
            _Streams.Clear();
            _PcrPid = 0;

            int len = SectionSize - 4; // 4 byte CRC am Ende abziehen.
            int i   = 8;               // start der Daten.

            _PcrPid |= SectionData[i++] << 8;
            _PcrPid |= SectionData[i++];
            _PcrPid &= 0x1fff;

            int piLen = 0;

            piLen |= SectionData[i++] << 8;
            piLen |= SectionData[i++];
            piLen &= 0x0fff;
            // Ende der Daten:
            piLen += i;

            while (i < piLen)
            {
                DescriptorBase desc = DescriptorFactory.CreateDescriptor(SectionData, i);
                _Descs.Add(desc);

                i += desc.Length;
            }

            while (i < len)
            {
                ElementaryStream es = new ElementaryStream(SectionData, i);
                _Streams.Add(es);

                i += es.Length;
            }
        }