internal void Write(IBinaryAccessor accessor, ProjectWriteState state)
        {
            accessor.Write((int)_flags);

            if (NameChanged)
            {
                accessor.Write7BitEncodedInt(state.SetString(_name));
            }
        }
        private void WriteAssemblies(IBinaryAccessor accessor, ProjectWriteState state)
        {
            accessor.Write7BitEncodedInt(_assemblies.Count);

            foreach (var assembly in _assemblies)
            {
                assembly.Write(accessor, state);
            }
        }
        internal void Write(IBinaryAccessor accessor, ProjectWriteState state)
        {
            accessor.Write((int)_flags);

            if (NameChanged)
            {
                accessor.Write7BitEncodedInt(state.SetString(_name));
            }

            WriteNamespaces(accessor, state);
            WriteTypes(accessor, state);
            WriteMethods(accessor, state);
            WriteFields(accessor, state);
            WriteProperties(accessor, state);
            WriteEvents(accessor, state);
        }
        private void WriteResources(IBinaryAccessor accessor, ProjectWriteState state)
        {
            int count = _resources != null ? _resources.Count : 0;

            accessor.Write7BitEncodedInt(count);

            if (count == 0)
            {
                return;
            }

            foreach (var kvp in _resources)
            {
                accessor.Write7BitEncodedInt(state.SetString(kvp.Key));
                kvp.Value.Write(accessor, state);
            }
        }
        private void WriteEvents(IBinaryAccessor accessor, ProjectWriteState state)
        {
            int count = _events != null ? _events.Count : 0;

            accessor.Write7BitEncodedInt(count);

            if (count == 0)
            {
                return;
            }

            foreach (var kvp in _events)
            {
                accessor.Write7BitEncodedInt(state.Signatures.Add(kvp.Key));
                kvp.Value.Write(accessor, state);
            }
        }
        public void Save(IBinaryAccessor accessor, string basePath)
        {
            var state = new ProjectWriteState();

            state.BasePath   = basePath;
            state.Strings    = new HashList <string>(50);
            state.Signatures = new WriteSignatureSerializer(100, state.Strings);

            accessor.Write((string)HeaderSignature, Encoding.UTF8);
            accessor.Write((short)0);
            accessor.Write((Guid)_projectID);
            accessor.Write((DateTime)_createdDate);
            accessor.Write((DateTime)DateTime.Now);
            accessor.Write((int)_flags);

            var blob = new Blob();

            WriteAssemblies(new BlobAccessor(blob), state);
            WriteStrings(accessor, state);
            WriteSignatures(accessor, state);
            accessor.Write(blob.GetBuffer(), 0, blob.Length);
        }
        private void WriteStrings(IBinaryAccessor accessor, ProjectWriteState state)
        {
            var strings = state.Strings;

            int count = strings.Count;

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

            blob.Write7BitEncodedInt(ref pos, count);

            var encoding = Encoding.UTF8;

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

            StrongCryptoUtils.Encrypt(blob.GetBuffer(), 0, blob.Length);

            accessor.Write7BitEncodedInt(blob.Length);
            accessor.Write(blob.GetBuffer(), 0, blob.Length);
        }
 private void WriteSignatures(IBinaryAccessor accessor, ProjectWriteState state)
 {
     byte[] buffer = state.Signatures.Save();
     accessor.Write7BitEncodedInt(buffer.Length);
     accessor.Write(buffer, 0, buffer.Length);
 }
Esempio n. 9
0
 internal void Write(IBinaryAccessor accessor, ProjectWriteState state)
 {
     accessor.Write((byte)_duplicateBehavior);
 }
Esempio n. 10
0
 internal void Write(IBinaryAccessor accessor, ProjectWriteState state)
 {
     accessor.Write((int)_flags);
 }
        internal void Write(IBinaryAccessor accessor, ProjectWriteState state)
        {
            accessor.Write7BitEncodedInt(state.SetString(ProjectHelper.MakeRelativePath(_filePath, state.BasePath)));
            accessor.Write7BitEncodedInt(state.SetString(ProjectHelper.MakeRelativePath(_outputPath, state.BasePath)));
            accessor.Write((int)_flags);
            accessor.Write((int)_flags2);
            accessor.Write((int)_flags3);

            if (NameChanged)
            {
                accessor.Write7BitEncodedInt(state.SetString(_name));
            }

            if (CultureChanged)
            {
                accessor.Write7BitEncodedInt(state.SetString(_culture));
            }

            if (VersionChanged)
            {
                accessor.Write((ushort)_version.Major);
                accessor.Write((ushort)_version.Minor);
                accessor.Write((ushort)_version.Build);
                accessor.Write((ushort)_version.Revision);
            }

            if (TitleChanged)
            {
                accessor.Write7BitEncodedInt(state.SetString(_title));
            }

            if (DescriptionChanged)
            {
                accessor.Write7BitEncodedInt(state.SetString(_description));
            }

            if (CompanyChanged)
            {
                accessor.Write7BitEncodedInt(state.SetString(_company));
            }

            if (ProductChanged)
            {
                accessor.Write7BitEncodedInt(state.SetString(_product));
            }

            if (CopyrightChanged)
            {
                accessor.Write7BitEncodedInt(state.SetString(_copyright));
            }

            if (TrademarkChanged)
            {
                accessor.Write7BitEncodedInt(state.SetString(_trademark));
            }

            if (_sign != null)
            {
                accessor.Write(true);
                _sign.Write(accessor, state);
            }
            else
            {
                accessor.Write(false);
            }

            WriteModules(accessor, state);
            WriteResources(accessor, state);
        }
 internal void Write(IBinaryAccessor accessor, ProjectWriteState state)
 {
     accessor.Write7BitEncodedInt(state.SetString(ProjectHelper.MakeRelativePath(_keyFilePath, state.BasePath)));
     accessor.Write7BitEncodedInt(state.SetString(_password));
     accessor.Write((bool)_delaySign);
 }