Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Extensions / Util / HexParser.cs / 1305376 / HexParser.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Web.Util {
using System;
using System.Globalization;
using System.Text;
internal static class HexParser {
public static byte[] Parse(string token) {
byte[] tokenBytes = new byte[token.Length / 2];
for (int i = 0; i < tokenBytes.Length; i++) {
tokenBytes[i] = Byte.Parse(token.Substring(i * 2, 2), NumberStyles.HexNumber, CultureInfo.InvariantCulture);
}
return tokenBytes;
}
public static string ToString(byte[] tokenBytes) {
StringBuilder tokenBuilder = new StringBuilder(tokenBytes.Length * 2);
for (int i = 0; i < tokenBytes.Length; i++) {
tokenBuilder.Append(tokenBytes[i].ToString("x2", CultureInfo.InvariantCulture));
}
return tokenBuilder.ToString();
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Web.Util {
using System;
using System.Globalization;
using System.Text;
internal static class HexParser {
public static byte[] Parse(string token) {
byte[] tokenBytes = new byte[token.Length / 2];
for (int i = 0; i < tokenBytes.Length; i++) {
tokenBytes[i] = Byte.Parse(token.Substring(i * 2, 2), NumberStyles.HexNumber, CultureInfo.InvariantCulture);
}
return tokenBytes;
}
public static string ToString(byte[] tokenBytes) {
StringBuilder tokenBuilder = new StringBuilder(tokenBytes.Length * 2);
for (int i = 0; i < tokenBytes.Length; i++) {
tokenBuilder.Append(tokenBytes[i].ToString("x2", CultureInfo.InvariantCulture));
}
return tokenBuilder.ToString();
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DBNull.cs
- UrlPath.cs
- TreeWalker.cs
- RightsManagementProvider.cs
- XmlNotation.cs
- SchemaNotation.cs
- HashCodeCombiner.cs
- RowToParametersTransformer.cs
- XamlSerializerUtil.cs
- UndoManager.cs
- Guid.cs
- ContourSegment.cs
- InstanceLockTracking.cs
- XMLSyntaxException.cs
- mediapermission.cs
- StoreItemCollection.Loader.cs
- Event.cs
- SecurityAppliedMessage.cs
- SqlCommandBuilder.cs
- ClientFormsIdentity.cs
- Misc.cs
- Trace.cs
- SmtpTransport.cs
- EntityProxyFactory.cs
- UInt32.cs
- FrameDimension.cs
- DataGridViewColumnDesignTimeVisibleAttribute.cs
- LoginName.cs
- HttpFileCollection.cs
- PropertyDescriptor.cs
- ExpressionWriter.cs
- ConnectionsZone.cs
- WebEventCodes.cs
- EncoderExceptionFallback.cs
- Table.cs
- StrokeCollection.cs
- XmlElementCollection.cs
- HttpModulesSection.cs
- FixedSOMImage.cs
- AutomationProperties.cs
- ConfigViewGenerator.cs
- Transactions.cs
- ContextMenuAutomationPeer.cs
- Pkcs7Signer.cs
- arclist.cs
- EventHandlerList.cs
- MediaElement.cs
- Helpers.cs
- ScriptModule.cs
- SpinLock.cs
- NumericUpDownAcceleration.cs
- MailDefinitionBodyFileNameEditor.cs
- RijndaelManagedTransform.cs
- DataGridHeaderBorder.cs
- ConfigurationManager.cs
- XamlReaderConstants.cs
- CheckBoxBaseAdapter.cs
- RouteItem.cs
- WindowsStartMenu.cs
- DataGridTextColumn.cs
- Thumb.cs
- DataGridViewColumn.cs
- XmlWrappingWriter.cs
- EUCJPEncoding.cs
- WsatExtendedInformation.cs
- CurrentTimeZone.cs
- XmlArrayItemAttributes.cs
- GlobalizationSection.cs
- Pen.cs
- SizeAnimationClockResource.cs
- DisplayMemberTemplateSelector.cs
- FileLevelControlBuilderAttribute.cs
- KeyBinding.cs
- CheckBoxRenderer.cs
- IntellisenseTextBox.cs
- XmlLoader.cs
- GridViewColumnCollectionChangedEventArgs.cs
- ComplusEndpointConfigContainer.cs
- GlyphElement.cs
- NotSupportedException.cs
- EnumConverter.cs
- Parser.cs
- DataServiceKeyAttribute.cs
- DataBoundLiteralControl.cs
- PathSegmentCollection.cs
- ToolStripSplitButton.cs
- XmlEnumAttribute.cs
- GeneralTransform3DTo2D.cs
- XmlSchemaInfo.cs
- AssociatedControlConverter.cs
- TimerElapsedEvenArgs.cs
- WebEncodingValidatorAttribute.cs
- DictionarySectionHandler.cs
- RowParagraph.cs
- WebPartAddingEventArgs.cs
- FrameworkContentElement.cs
- BinaryNode.cs
- DataGridViewUtilities.cs
- NamespaceDisplay.xaml.cs
- basecomparevalidator.cs