private void ReadSignatures(IBinaryAccessor accessor, ProjectReadState state)
        {
            int blobSize = accessor.Read7BitEncodedInt();
            var blob     = new Blob(accessor.ReadBytes(blobSize));

            state.Signatures = new ReadSignatureSerializer(new BlobAccessor(blob), state.Strings);
        }
        internal void Read(IBinaryAccessor accessor, ProjectReadState state)
        {
            _flags = accessor.ReadInt32();

            if (NameChanged)
            {
                _name = state.GetString(accessor.Read7BitEncodedInt());
            }
        }
        private void Read(IBinaryAccessor accessor, ProjectReadState state)
        {
            _projectID        = accessor.ReadGuid();
            _createdDate      = accessor.ReadDateTime();
            _lastModifiedDate = accessor.ReadDateTime();
            _flags            = accessor.ReadInt32();

            ReadStrings(accessor, state);
            ReadSignatures(accessor, state);
            ReadAssemblies(accessor, state);
        }
        private static Project Read(IBinaryAccessor accessor, string basePath)
        {
            if (HeaderSignature != accessor.ReadString(6, Encoding.UTF8))
            {
                throw new ProjectException(SR.ProjectNotValid);
            }

            accessor.Position += 2;

            var state = new ProjectReadState();

            state.BasePath = basePath;

            return(new Project(accessor, state));
        }
        internal void Read(IBinaryAccessor accessor, ProjectReadState state)
        {
            _flags = accessor.ReadInt32();

            if (NameChanged)
            {
                _name = state.GetString(accessor.Read7BitEncodedInt());
            }

            ReadNamespaces(accessor, state);
            ReadTypes(accessor, state);
            ReadMethods(accessor, state);
            ReadFields(accessor, state);
            ReadProperties(accessor, state);
            ReadEvents(accessor, state);
        }
        private void ReadEvents(IBinaryAccessor accessor, ProjectReadState state)
        {
            int count = accessor.Read7BitEncodedInt();

            if (count == 0)
            {
                return;
            }

            _events = new Dictionary <IEventSignature, ProjectEvent>(count, SignatureComparer.IgnoreTypeOwner_IgnoreAssemblyStrongName);

            for (int i = 0; i < count; i++)
            {
                var eventSig = (EventReference)state.Signatures[accessor.Read7BitEncodedInt()];
                _events.Add(eventSig, new ProjectEvent(accessor, state));
            }
        }
        private void ReadProperties(IBinaryAccessor accessor, ProjectReadState state)
        {
            int count = accessor.Read7BitEncodedInt();

            if (count == 0)
            {
                return;
            }

            _properties = new Dictionary <IPropertySignature, ProjectProperty>(count, SignatureComparer.IgnoreTypeOwner_IgnoreAssemblyStrongName);

            for (int i = 0; i < count; i++)
            {
                var propertySig = (PropertyReference)state.Signatures[accessor.Read7BitEncodedInt()];
                _properties.Add(propertySig, new ProjectProperty(accessor, state));
            }
        }
        private void ReadMethods(IBinaryAccessor accessor, ProjectReadState state)
        {
            int count = accessor.Read7BitEncodedInt();

            if (count == 0)
            {
                return;
            }

            _methods = new Dictionary <IMethodSignature, ProjectMethod>(count, SignatureComparer.IgnoreTypeOwner_IgnoreAssemblyStrongName);

            for (int i = 0; i < count; i++)
            {
                var methodSig = (MethodSignature)state.Signatures[accessor.Read7BitEncodedInt()];
                _methods.Add(methodSig, new ProjectMethod(accessor, state));
            }
        }
        private void ReadNamespaces(IBinaryAccessor accessor, ProjectReadState state)
        {
            int count = accessor.Read7BitEncodedInt();

            if (count == 0)
            {
                return;
            }

            _namespaces = new Dictionary <string, ProjectNamespace>(count);

            for (int i = 0; i < count; i++)
            {
                string name = state.GetString(accessor.Read7BitEncodedInt());
                _namespaces.Add(name, new ProjectNamespace(accessor, state));
            }
        }
        private void ReadResources(IBinaryAccessor accessor, ProjectReadState state)
        {
            int count = accessor.Read7BitEncodedInt();

            if (count == 0)
            {
                return;
            }

            _resources = new Dictionary <string, ProjectResource>(count, StringComparer.OrdinalIgnoreCase);

            for (int i = 0; i < count; i++)
            {
                string name = state.GetString(accessor.Read7BitEncodedInt());
                _resources.Add(name, new ProjectResource(accessor, state));
            }
        }
        private void ReadAssemblies(IBinaryAccessor accessor, ProjectReadState state)
        {
            int count = accessor.Read7BitEncodedInt();

            if (count > 0)
            {
                _assemblies = new List <ProjectAssembly>(count);

                for (int i = 0; i < count; i++)
                {
                    _assemblies.Add(new ProjectAssembly(accessor, state));
                }
            }
            else
            {
                _assemblies = new List <ProjectAssembly>();
            }
        }
        private void ReadStrings(IBinaryAccessor accessor, ProjectReadState state)
        {
            int blobSize = accessor.Read7BitEncodedInt();

            byte[] buffer = accessor.ReadBytes(blobSize);
            StrongCryptoUtils.Decrypt(buffer, 0, blobSize);

            var blob = new Blob(buffer);
            int pos  = 0;

            int count    = blob.Read7BitEncodedInt(ref pos);
            var strings  = new string[count];
            var encoding = Encoding.UTF8;

            for (int i = 0; i < count; i++)
            {
                strings[i] = blob.ReadLengthPrefixedString(ref pos, encoding);
            }

            state.Strings = strings;
        }
        internal void Read(IBinaryAccessor accessor, ProjectReadState state)
        {
            _filePath   = ProjectHelper.MakeAbsolutePath(state.GetString(accessor.Read7BitEncodedInt()), state.BasePath);
            _outputPath = ProjectHelper.MakeAbsolutePath(state.GetString(accessor.Read7BitEncodedInt()), state.BasePath);
            _flags      = accessor.ReadInt32();
            _flags2     = accessor.ReadInt32();
            _flags3     = accessor.ReadInt32();

            if (NameChanged)
            {
                _name = state.GetString(accessor.Read7BitEncodedInt());
            }

            if (CultureChanged)
            {
                _culture = state.GetString(accessor.Read7BitEncodedInt());
            }

            if (VersionChanged)
            {
                _version = new Version(accessor.ReadUInt16(), accessor.ReadUInt16(), accessor.ReadUInt16(), accessor.ReadUInt16());
            }

            if (TitleChanged)
            {
                _title = state.GetString(accessor.Read7BitEncodedInt());
            }

            if (DescriptionChanged)
            {
                _description = state.GetString(accessor.Read7BitEncodedInt());
            }

            if (CompanyChanged)
            {
                _company = state.GetString(accessor.Read7BitEncodedInt());
            }

            if (ProductChanged)
            {
                _product = state.GetString(accessor.Read7BitEncodedInt());
            }

            if (CopyrightChanged)
            {
                _copyright = state.GetString(accessor.Read7BitEncodedInt());
            }

            if (TrademarkChanged)
            {
                _trademark = state.GetString(accessor.Read7BitEncodedInt());
            }

            if (accessor.ReadBoolean())
            {
                _sign = new ProjectAssemblySign(accessor, state);
            }

            ReadModules(accessor, state);
            ReadResources(accessor, state);
        }
Exemple #14
0
 internal void Read(IBinaryAccessor accessor, ProjectReadState state)
 {
     _duplicateBehavior = (MergeDuplicateBehavior)accessor.ReadByte();
 }
Exemple #15
0
 internal ProjectAssemblyMerge(IBinaryAccessor accessor, ProjectReadState state)
 {
     Read(accessor, state);
 }
Exemple #16
0
 internal void Read(IBinaryAccessor accessor, ProjectReadState state)
 {
     _flags = accessor.ReadInt32();
 }
Exemple #17
0
 internal ProjectResource(IBinaryAccessor accessor, ProjectReadState state)
 {
     Read(accessor, state);
 }
 internal ProjectMethod(IBinaryAccessor accessor, ProjectReadState state)
 {
     Read(accessor, state);
 }
 internal void Read(IBinaryAccessor accessor, ProjectReadState state)
 {
     _keyFilePath = ProjectHelper.MakeAbsolutePath(state.GetString(accessor.Read7BitEncodedInt()), state.BasePath);
     _password    = state.GetString(accessor.Read7BitEncodedInt());
     _delaySign   = accessor.ReadBoolean();
 }
 internal ProjectProperty(IBinaryAccessor accessor, ProjectReadState state)
 {
     Read(accessor, state);
 }
 internal ProjectEvent(IBinaryAccessor accessor, ProjectReadState state)
 {
     Read(accessor, state);
 }
 private Project(IBinaryAccessor accessor, ProjectReadState state)
 {
     Read(accessor, state);
 }
 internal ProjectNamespace(IBinaryAccessor accessor, ProjectReadState state)
 {
     Read(accessor, state);
 }