/// <internalonly/> int IBuiltInEvidence.InitFromBuffer(char[] buffer, int position) { int length = BuiltInEvidenceHelper.GetIntFromCharArray(buffer, position); position += 2; m_publicKeyBlob = new StrongNamePublicKeyBlob(); m_publicKeyBlob.PublicKey = new byte[length]; int lengthInChars = ((length - 1) / 2) + 1; Buffer.InternalBlockCopy(buffer, position * 2, m_publicKeyBlob.PublicKey, 0, length); position += lengthInChars; int major = BuiltInEvidenceHelper.GetIntFromCharArray(buffer, position); int minor = BuiltInEvidenceHelper.GetIntFromCharArray(buffer, position + 2); int build = BuiltInEvidenceHelper.GetIntFromCharArray(buffer, position + 4); int revision = BuiltInEvidenceHelper.GetIntFromCharArray(buffer, position + 6); m_version = new Version(major, minor, build, revision); position += 8; length = BuiltInEvidenceHelper.GetIntFromCharArray(buffer, position); position += 2; m_name = new String(buffer, position, length); return(position + length); }
/// <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); }
/// <include file='doc\ApplicationDirectory.uex' path='docs/doc[@for="ApplicationDirectory.char1"]/*' /> /// <internalonly/> int IBuiltInEvidence.InitFromBuffer(char[] buffer, int position) { int length = BuiltInEvidenceHelper.GetIntFromCharArray(buffer, position); position += 2; m_appDirectory = new URLString(new String(buffer, position, length)); return(position + length); }
/// <include file='doc\Hash.uex' path='docs/doc[@for="Hash.char1"]/*' /> /// <internalonly/> int IBuiltInEvidence.InitFromBuffer(char[] buffer, int position) { int length = BuiltInEvidenceHelper.GetIntFromCharArray(buffer, position); position += 2; m_rawData = new byte[length]; int lengthInChars = ((length - 1) / 2) + 1; Buffer.InternalBlockCopy(buffer, position * 2, m_rawData, 0, length); return(position + lengthInChars); }
/// <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); }
/// <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); }
/// <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); }
/// <include file='doc\PermissionRequestEvidence.uex' path='docs/doc[@for="PermissionRequestEvidence.char1"]/*' /> /// <internalonly/> int IBuiltInEvidence.InitFromBuffer(char[] buffer, int position) { int numPermSets = BuiltInEvidenceHelper.GetIntFromCharArray(buffer, position); position += 2; int tempLength; for (int i = 0; i < numPermSets; i++) { char psKind = buffer[position++]; tempLength = BuiltInEvidenceHelper.GetIntFromCharArray(buffer, position); position += 2; String tempStr = new String(buffer, position, tempLength); position += tempLength; Parser p = new Parser(tempStr); PermissionSet psTemp = new PermissionSet(); psTemp.FromXml(p.GetTopElement()); switch (psKind) { case idRequest: m_strRequest = tempStr; m_request = psTemp; break; case idOptional: m_strOptional = tempStr; m_optional = psTemp; break; case idDenied: m_strDenied = tempStr; m_denied = psTemp; break; default: throw new SerializationException(Environment.GetResourceString("Serialization_UnableToFixup")); } } return(position); }
/// <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); }
/// <include file='doc\Zone.uex' path='docs/doc[@for="Zone.char1"]/*' /> /// <internalonly/> int IBuiltInEvidence.InitFromBuffer(char[] buffer, int position) { m_zone = (SecurityZone)BuiltInEvidenceHelper.GetIntFromCharArray(buffer, position); return(position + 2); }
/// <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); }