CopyIntToCharArray() static private method

static private CopyIntToCharArray ( int value, char buffer, int position ) : void
value int
buffer char
position int
return void
Beispiel #1
0
        /// <internalonly/>
        int IBuiltInEvidence.OutputToBuffer(char[] buffer, int position, bool verbose)
        {
            // StrongNames have a byte[], a string, and a Version (4 ints).
            // Copy in the id, the byte[], the four ints, and then the string.

            buffer[position++] = BuiltInEvidenceHelper.idStrongName;
            int lengthPK = m_publicKeyBlob.PublicKey.Length;

            if (verbose)
            {
                BuiltInEvidenceHelper.CopyIntToCharArray(lengthPK, buffer, position);
                position += 2;
            }
            Buffer.InternalBlockCopy(m_publicKeyBlob.PublicKey, 0, buffer, position * 2, lengthPK);
            position += ((lengthPK - 1) / 2) + 1;

            BuiltInEvidenceHelper.CopyIntToCharArray(m_version.Major, buffer, position);
            BuiltInEvidenceHelper.CopyIntToCharArray(m_version.Minor, buffer, position + 2);
            BuiltInEvidenceHelper.CopyIntToCharArray(m_version.Build, buffer, position + 4);
            BuiltInEvidenceHelper.CopyIntToCharArray(m_version.Revision, buffer, position + 6);

            position += 8;
            int lengthName = m_name.Length;

            if (verbose)
            {
                BuiltInEvidenceHelper.CopyIntToCharArray(lengthName, buffer, position);
                position += 2;
            }
            m_name.CopyTo(0, buffer, position, lengthName);

            return(lengthName + position);
        }
Beispiel #2
0
        /// <include file='doc\ApplicationDirectory.uex' path='docs/doc[@for="ApplicationDirectory.char"]/*' />
        /// <internalonly/>
        int IBuiltInEvidence.OutputToBuffer(char[] buffer, int position, bool verbose)
        {
            buffer[position++] = BuiltInEvidenceHelper.idApplicationDirectory;
            String directory = this.Directory;
            int    length    = directory.Length;

            if (verbose)
            {
                BuiltInEvidenceHelper.CopyIntToCharArray(length, buffer, position);
                position += 2;
            }
            directory.CopyTo(0, buffer, position, length);
            return(length + position);
        }
Beispiel #3
0
        /// <internalonly/>
        int IBuiltInEvidence.OutputToBuffer(char[] buffer, int position, bool verbose)
        {
            buffer[position++] = BuiltInEvidenceHelper.idSite;
            String name   = this.Name;
            int    length = name.Length;

            if (verbose)
            {
                BuiltInEvidenceHelper.CopyIntToCharArray(length, buffer, position);
                position += 2;
            }
            name.CopyTo(0, buffer, position, length);
            return(length + position);
        }
Beispiel #4
0
        /// <include file='doc\Publisher.uex' path='docs/doc[@for="Publisher.char"]/*' />
        /// <internalonly/>
        int IBuiltInEvidence.OutputToBuffer(char[] buffer, int position, bool verbose)
        {
            buffer[position++] = BuiltInEvidenceHelper.idPublisher;
            byte[] certData = this.Certificate.GetRawCertData();
            int    length   = certData.Length;

            if (verbose)
            {
                BuiltInEvidenceHelper.CopyIntToCharArray(length, buffer, position);
                position += 2;
            }

            Buffer.InternalBlockCopy(certData, 0, buffer, position * 2, length);
            return(((length - 1) / 2) + 1 + position);
        }
Beispiel #5
0
        /// <include file='doc\Hash.uex' path='docs/doc[@for="Hash.char"]/*' />
        /// <internalonly/>
        int IBuiltInEvidence.OutputToBuffer(char[] buffer, int position, bool verbose)
        {
            if (!verbose)
            {
                return(position);
            }

            buffer[position++] = BuiltInEvidenceHelper.idHash;

            if (m_rawData == null)
            {
                m_rawData = _GetRawData(m_assembly);
            }
            int length = ((m_rawData.Length - 1) / 2) + 1;

            BuiltInEvidenceHelper.CopyIntToCharArray(m_rawData.Length, buffer, position);
            position += 2;

            Buffer.InternalBlockCopy(m_rawData, 0, buffer, position * 2, m_rawData.Length);

            return(position + length);
        }
        /// <include file='doc\PermissionRequestEvidence.uex' path='docs/doc[@for="PermissionRequestEvidence.char"]/*' />
        /// <internalonly/>
        int IBuiltInEvidence.OutputToBuffer(char[] buffer, int position, bool verbose)
        {
            CreateStrings();

            int currentPosition = position;
            int numPermSetsPos = 0, numPermSets = 0;
            int tempLength;

            buffer[currentPosition++] = BuiltInEvidenceHelper.idPermissionRequestEvidence;

            if (verbose)
            {
                // Reserve some space to store the number of permission sets added
                numPermSetsPos   = currentPosition;
                currentPosition += 2;
            }

            if (m_strRequest != null)
            {
                tempLength = m_strRequest.Length;
                if (verbose)
                {
                    buffer[currentPosition++] = idRequest;
                    BuiltInEvidenceHelper.CopyIntToCharArray(tempLength, buffer, currentPosition);
                    currentPosition += 2;
                    numPermSets++;
                }
                m_strRequest.CopyTo(0, buffer, currentPosition, tempLength);
                currentPosition += tempLength;
            }

            if (m_strOptional != null)
            {
                tempLength = m_strOptional.Length;
                if (verbose)
                {
                    buffer[currentPosition++] = idOptional;
                    BuiltInEvidenceHelper.CopyIntToCharArray(tempLength, buffer, currentPosition);
                    currentPosition += 2;
                    numPermSets++;
                }
                m_strOptional.CopyTo(0, buffer, currentPosition, tempLength);
                currentPosition += tempLength;
            }

            if (m_strDenied != null)
            {
                tempLength = m_strDenied.Length;
                if (verbose)
                {
                    buffer[currentPosition++] = idDenied;
                    BuiltInEvidenceHelper.CopyIntToCharArray(tempLength, buffer, currentPosition);
                    currentPosition += 2;
                    numPermSets++;
                }
                m_strDenied.CopyTo(0, buffer, currentPosition, tempLength);
                currentPosition += tempLength;
            }

            if (verbose)
            {
                BuiltInEvidenceHelper.CopyIntToCharArray(numPermSets, buffer, numPermSetsPos);
            }

            return(currentPosition);
        }
Beispiel #7
0
 /// <include file='doc\Zone.uex' path='docs/doc[@for="Zone.char"]/*' />
 /// <internalonly/>
 int IBuiltInEvidence.OutputToBuffer(char[] buffer, int position, bool verbose)
 {
     buffer[position] = BuiltInEvidenceHelper.idZone;
     BuiltInEvidenceHelper.CopyIntToCharArray((int)m_zone, buffer, position + 1);
     return(position + 3);
 }