Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Net / System / Net / Mail / WriteStateInfoBase.cs / 1305376 / WriteStateInfoBase.cs
namespace System.Net.Mime { internal abstract class WriteStateInfoBase { protected byte[] _header; protected byte[] _footer; protected int _maxLineLength; protected byte[] buffer; protected int _mimeHeaderLength; //1024 was originally set in the encoding streams protected const int defaultBufferSize = 1024; internal WriteStateInfoBase() { this.buffer = new byte[defaultBufferSize]; this._header = new byte[0]; ; this._footer = new byte[0]; this._maxLineLength = EncodedStreamFactory.DefaultMaxLineLength; this._mimeHeaderLength = 0; } internal WriteStateInfoBase(int bufferSize, byte[] header, byte[] footer, int maxLineLength) { this.buffer = new byte[bufferSize]; this._header = header; this._footer = footer; this._maxLineLength = maxLineLength; this._mimeHeaderLength = 0; } internal int FooterLength { get { return _footer.Length; } } //The actual length of the header that this will be appended to //e.g. Subject : //this length is taken into account for folding on the first line internal int MimeHeaderLength { get { return this._mimeHeaderLength; } set { this._mimeHeaderLength = value; } } internal int HeaderLength { get { return _header.Length; } } internal byte[] Footer { get { return _footer; } } internal byte[] Header { get { return _header; } } internal byte[] Buffer { get { return this.buffer; } } internal int Length { get; set; } internal int CurrentLineLength { get; set; } //attempt to increase the buffer length. //returns false if buffer length is at int(max) internal void ResizeBuffer() { int newsize = buffer.Length * 2; //try to resize- if the machine doesn't have the memory to resize just let it throw byte[] tempBuffer = new byte[newsize]; buffer.CopyTo(tempBuffer, 0); this.buffer = tempBuffer; } internal void AppendHeader() { if (this.Header != null) { this.Header.CopyTo(this.buffer, this.Length); this.CurrentLineLength += this.HeaderLength; this.Length += this.HeaderLength; } } internal void AppendFooter() { if (this.Footer != null) { this.Footer.CopyTo(this.buffer, this.Length); this.CurrentLineLength += this.FooterLength; this.Length += this.FooterLength; } } internal int MaxLineLength { get { return this._maxLineLength; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. namespace System.Net.Mime { internal abstract class WriteStateInfoBase { protected byte[] _header; protected byte[] _footer; protected int _maxLineLength; protected byte[] buffer; protected int _mimeHeaderLength; //1024 was originally set in the encoding streams protected const int defaultBufferSize = 1024; internal WriteStateInfoBase() { this.buffer = new byte[defaultBufferSize]; this._header = new byte[0]; ; this._footer = new byte[0]; this._maxLineLength = EncodedStreamFactory.DefaultMaxLineLength; this._mimeHeaderLength = 0; } internal WriteStateInfoBase(int bufferSize, byte[] header, byte[] footer, int maxLineLength) { this.buffer = new byte[bufferSize]; this._header = header; this._footer = footer; this._maxLineLength = maxLineLength; this._mimeHeaderLength = 0; } internal int FooterLength { get { return _footer.Length; } } //The actual length of the header that this will be appended to //e.g. Subject : //this length is taken into account for folding on the first line internal int MimeHeaderLength { get { return this._mimeHeaderLength; } set { this._mimeHeaderLength = value; } } internal int HeaderLength { get { return _header.Length; } } internal byte[] Footer { get { return _footer; } } internal byte[] Header { get { return _header; } } internal byte[] Buffer { get { return this.buffer; } } internal int Length { get; set; } internal int CurrentLineLength { get; set; } //attempt to increase the buffer length. //returns false if buffer length is at int(max) internal void ResizeBuffer() { int newsize = buffer.Length * 2; //try to resize- if the machine doesn't have the memory to resize just let it throw byte[] tempBuffer = new byte[newsize]; buffer.CopyTo(tempBuffer, 0); this.buffer = tempBuffer; } internal void AppendHeader() { if (this.Header != null) { this.Header.CopyTo(this.buffer, this.Length); this.CurrentLineLength += this.HeaderLength; this.Length += this.HeaderLength; } } internal void AppendFooter() { if (this.Footer != null) { this.Footer.CopyTo(this.buffer, this.Length); this.CurrentLineLength += this.FooterLength; this.Length += this.FooterLength; } } internal int MaxLineLength { get { return this._maxLineLength; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ShortcutKeysEditor.cs
- MethodExpr.cs
- DbConnectionPoolGroup.cs
- ObjectConverter.cs
- GZipUtils.cs
- And.cs
- PenCursorManager.cs
- EventLogStatus.cs
- DeclaredTypeElement.cs
- DocumentOrderQuery.cs
- DataGridDesigner.cs
- ClientSession.cs
- HyperLinkDataBindingHandler.cs
- ClientCultureInfo.cs
- RequestQueryParser.cs
- ReferenceSchema.cs
- WebPartUserCapability.cs
- HtmlControlPersistable.cs
- xml.cs
- BrushConverter.cs
- FunctionParameter.cs
- SqlCacheDependencyDatabase.cs
- FaultReason.cs
- DoubleAnimationBase.cs
- ReflectionPermission.cs
- ImageProxy.cs
- DeobfuscatingStream.cs
- WindowsMenu.cs
- SRGSCompiler.cs
- SecurityException.cs
- OwnerDrawPropertyBag.cs
- LocalizableAttribute.cs
- HttpListenerPrefixCollection.cs
- ParsedAttributeCollection.cs
- Glyph.cs
- SynthesizerStateChangedEventArgs.cs
- SQLInt64.cs
- CachingHintValidation.cs
- IsolatedStoragePermission.cs
- OperationFormatter.cs
- RenderTargetBitmap.cs
- COM2PictureConverter.cs
- RootCodeDomSerializer.cs
- MessageDroppedTraceRecord.cs
- BooleanProjectedSlot.cs
- DbConnectionPoolIdentity.cs
- XmlSchemaAppInfo.cs
- ListViewEditEventArgs.cs
- ModuleBuilderData.cs
- XmlChildEnumerator.cs
- ConfigurationSchemaErrors.cs
- ImageField.cs
- OptimizedTemplateContentHelper.cs
- TraceContext.cs
- XmlUTF8TextWriter.cs
- RTTypeWrapper.cs
- XmlSchemaSet.cs
- BamlTreeMap.cs
- AssertFilter.cs
- PageCatalogPart.cs
- TreeChangeInfo.cs
- WindowsBrush.cs
- StorageMappingItemLoader.cs
- StrokeNode.cs
- LogArchiveSnapshot.cs
- RegistryKey.cs
- SystemDropShadowChrome.cs
- COM2Properties.cs
- KeySpline.cs
- FileUtil.cs
- SchemaNotation.cs
- ChangeBlockUndoRecord.cs
- SymbolEqualComparer.cs
- ScrollBarRenderer.cs
- DoubleLink.cs
- ResourceDescriptionAttribute.cs
- ProfileSection.cs
- NativeMethods.cs
- ExecutionContext.cs
- SystemColors.cs
- CustomAttributeFormatException.cs
- RepeaterDataBoundAdapter.cs
- DBSchemaTable.cs
- TextMarkerSource.cs
- ComplexPropertyEntry.cs
- ConstraintStruct.cs
- EndpointNotFoundException.cs
- XmlTypeAttribute.cs
- CodeCatchClauseCollection.cs
- ThemeDirectoryCompiler.cs
- QueryNode.cs
- OdbcConnectionOpen.cs
- BufferAllocator.cs
- CodeCommentStatementCollection.cs
- StorageBasedPackageProperties.cs
- lengthconverter.cs
- SqlConnectionString.cs
- DecoderReplacementFallback.cs
- NamedPipeConnectionPool.cs
- Model3DGroup.cs