Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CompMod / System / ComponentModel / Design / DesigntimeLicenseContextSerializer.cs / 1305376 / DesigntimeLicenseContextSerializer.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.ComponentModel.Design { using System.Runtime.Remoting; using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Serialization; using System.Security; using System.Security.Permissions; using System.Collections; using System.ComponentModel; using System.Diagnostics; using System; using Microsoft.Win32; using System.IO; using System.Diagnostics.CodeAnalysis; ////// [HostProtection(SharedState = true)] [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.InheritanceDemand, Name = "FullTrust")] [System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.LinkDemand, Name="FullTrust")] public class DesigntimeLicenseContextSerializer { // not creatable... // private DesigntimeLicenseContextSerializer() { } ////// Provides support for design-time license context serialization. /// ////// public static void Serialize(Stream o, string cryptoKey, DesigntimeLicenseContext context) { IFormatter formatter = new BinaryFormatter(); formatter.Serialize(o, new object[] {cryptoKey, context.savedLicenseKeys}); } [SuppressMessage("Microsoft.Security", "CA2107:ReviewDenyAndPermitOnlyUsage")] // Use of PermitOnly here is appropriate. This was a previous war-approved security bug fix. internal static void Deserialize(Stream o, string cryptoKey, RuntimeLicenseContext context) { IFormatter formatter = new BinaryFormatter(); object obj; new SecurityPermission(SecurityPermissionFlag.SerializationFormatter).PermitOnly(); new SecurityPermission(SecurityPermissionFlag.SerializationFormatter).Assert(); try { obj = formatter.Deserialize(o); } finally { CodeAccessPermission.RevertAssert(); CodeAccessPermission.RevertPermitOnly(); } if (obj is object[]) { object[] value = (object[])obj; if (value[0] is string && (string)value[0] == cryptoKey) { context.savedLicenseKeys = (Hashtable)value[1]; } } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007./// Serializes the licenses within the specified design-time license context /// using the specified key and output stream. /// ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- RestrictedTransactionalPackage.cs
- WbmpConverter.cs
- Transform.cs
- ComponentChangedEvent.cs
- MultiTrigger.cs
- XsltException.cs
- TextElementEnumerator.cs
- EntityReference.cs
- Geometry.cs
- SmtpException.cs
- WebEvents.cs
- TimeoutHelper.cs
- StaticTextPointer.cs
- InputLanguageCollection.cs
- SizeAnimationClockResource.cs
- TraceAsyncResult.cs
- SafeRightsManagementPubHandle.cs
- DbExpressionBuilder.cs
- ResourceWriter.cs
- DoubleCollectionValueSerializer.cs
- DataSysAttribute.cs
- EntityViewGenerationAttribute.cs
- IndexedWhereQueryOperator.cs
- PointLight.cs
- GenerateTemporaryTargetAssembly.cs
- DataView.cs
- SpellerError.cs
- Monitor.cs
- infer.cs
- WorkflowExecutor.cs
- SmiEventSink_DeferedProcessing.cs
- CachedPathData.cs
- MsmqDiagnostics.cs
- CacheEntry.cs
- NullableDecimalMinMaxAggregationOperator.cs
- GradientBrush.cs
- TextBoxAutoCompleteSourceConverter.cs
- ControlAdapter.cs
- AudioLevelUpdatedEventArgs.cs
- NotCondition.cs
- IOThreadScheduler.cs
- TraceContext.cs
- DataShape.cs
- AesManaged.cs
- XmlSchemaAnyAttribute.cs
- KerberosRequestorSecurityTokenAuthenticator.cs
- FormViewUpdatedEventArgs.cs
- ApplicationCommands.cs
- DataGridCaption.cs
- ReaderWriterLockSlim.cs
- DataControlFieldHeaderCell.cs
- HostedElements.cs
- UpDownBase.cs
- ComponentConverter.cs
- StretchValidation.cs
- WsatConfiguration.cs
- CompensationTokenData.cs
- SerializationInfo.cs
- TextBounds.cs
- UpWmlMobileTextWriter.cs
- ListViewContainer.cs
- COSERVERINFO.cs
- CrossAppDomainChannel.cs
- PermissionListSet.cs
- ListenerElementsCollection.cs
- CodeStatementCollection.cs
- InvokeMethod.cs
- HttpChannelHelper.cs
- AspNetRouteServiceHttpHandler.cs
- BitmapEffectInputData.cs
- OracleDataReader.cs
- ToolBarButton.cs
- IdnElement.cs
- SR.cs
- ObjectConverter.cs
- BitmapDownload.cs
- CmsInterop.cs
- HtmlForm.cs
- SuppressMessageAttribute.cs
- StaticResourceExtension.cs
- ExecutionContext.cs
- SelectionItemPattern.cs
- securestring.cs
- _AutoWebProxyScriptHelper.cs
- BulletDecorator.cs
- SiteOfOriginPart.cs
- RegexGroupCollection.cs
- XsdBuildProvider.cs
- SmtpNtlmAuthenticationModule.cs
- XmlTextWriter.cs
- IisTraceListener.cs
- CodeBlockBuilder.cs
- dtdvalidator.cs
- DiscoveryUtility.cs
- UIElement.cs
- AsyncStreamReader.cs
- GrammarBuilderBase.cs
- SolidBrush.cs
- TokenCreationParameter.cs
- DocComment.cs