Code:
/ FXUpdate3074 / FXUpdate3074 / 1.1 / DEVDIV / depot / DevDiv / releases / whidbey / QFE / ndp / fx / src / xsp / System / Web / Profile / ProfileInfo.cs / 1 / ProfileInfo.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
/*
* ProfileInfo
*
* Copyright (c) 2002 Microsoft Corporation
*/
namespace System.Web.Profile
{
using System.Security.Principal;
using System.Security.Permissions;
using System.Collections;
using System.Collections.Specialized;
using System.Web.Configuration;
using System.Web.Util;
using System.Web.Security;
using System.Web.Compilation;
using System.Configuration;
using System.Configuration.Provider;
using System.Reflection;
using System.CodeDom;
[Serializable]
[AspNetHostingPermission(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)]
public class ProfileInfo
{
public ProfileInfo(string username, bool isAnonymous, DateTime lastActivityDate, DateTime lastUpdatedDate, int size)
{
if( username != null )
{
username = username.Trim();
}
_UserName = username;
if (lastActivityDate.Kind == DateTimeKind.Local) {
lastActivityDate = lastActivityDate.ToUniversalTime();
}
_LastActivityDate = lastActivityDate;
if (lastUpdatedDate.Kind == DateTimeKind.Local) {
lastUpdatedDate = lastUpdatedDate.ToUniversalTime();
}
_LastUpdatedDate = lastUpdatedDate;
_IsAnonymous = isAnonymous;
_Size = size;
}
protected ProfileInfo() { }
public virtual string UserName { get { return _UserName;} }
public virtual DateTime LastActivityDate { get { return _LastActivityDate.ToLocalTime();} }
public virtual DateTime LastUpdatedDate { get { return _LastUpdatedDate.ToLocalTime(); } }
public virtual bool IsAnonymous { get { return _IsAnonymous;} }
public virtual int Size { get { return _Size; } }
private string _UserName;
private DateTime _LastActivityDate;
private DateTime _LastUpdatedDate;
private bool _IsAnonymous;
private int _Size;
}
[Serializable]
[AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)]
public sealed class ProfileInfoCollection : IEnumerable, ICollection
{
private Hashtable _Hashtable = null;
private ArrayList _ArrayList = null;
private bool _ReadOnly = false;
private int _CurPos = 0;
private int _NumBlanks = 0;
public ProfileInfoCollection() {
_Hashtable = new Hashtable(10, StringComparer.CurrentCultureIgnoreCase);
_ArrayList = new ArrayList();
}
public void Add(ProfileInfo profileInfo)
{
if (_ReadOnly)
throw new NotSupportedException();
if (profileInfo == null || profileInfo.UserName == null)
throw new ArgumentNullException( "profileInfo" );
_Hashtable.Add(profileInfo.UserName, _CurPos);
_ArrayList.Add(profileInfo);
_CurPos++;
}
public void Remove(string name)
{
if (_ReadOnly)
throw new NotSupportedException();
object pos = _Hashtable[name];
if (pos == null)
return;
_Hashtable.Remove(name);
_ArrayList[(int)pos] = null;
_NumBlanks++;
}
public ProfileInfo this[string name]
{
get {
object pos = _Hashtable[name];
if (pos == null)
return null;
return _ArrayList[(int)pos] as ProfileInfo;
}
}
public IEnumerator GetEnumerator() {
DoCompact();
return _ArrayList.GetEnumerator();
}
public void SetReadOnly() {
if (_ReadOnly)
return;
_ReadOnly = true;
}
public void Clear() {
if (_ReadOnly)
throw new NotSupportedException();
_Hashtable.Clear();
_ArrayList.Clear();
_CurPos = 0;
_NumBlanks = 0;
}
public int Count { get { return _Hashtable.Count; } }
public bool IsSynchronized {get { return false;}}
public object SyncRoot {get { return this;}}
public void CopyTo(Array array, int index)
{
DoCompact();
_ArrayList.CopyTo(array, index);
}
public void CopyTo(ProfileInfo [] array, int index)
{
DoCompact();
_ArrayList.CopyTo(array, index);
}
private void DoCompact() {
if (_NumBlanks < 1)
return;
ArrayList al = new ArrayList(_CurPos - _NumBlanks);
int firstBlankPos = -1;
for (int iter = 0; iter < _CurPos; iter++) {
if (_ArrayList[iter] != null)
al.Add(_ArrayList[iter]);
else if (firstBlankPos == -1)
firstBlankPos = iter;
}
_NumBlanks = 0;
_ArrayList = al;
_CurPos = _ArrayList.Count;
for (int iter = firstBlankPos; iter < _CurPos; iter++) {
ProfileInfo profileInfo = _ArrayList[iter] as ProfileInfo;
_Hashtable[profileInfo.UserName] = iter;
}
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
/*
* ProfileInfo
*
* Copyright (c) 2002 Microsoft Corporation
*/
namespace System.Web.Profile
{
using System.Security.Principal;
using System.Security.Permissions;
using System.Collections;
using System.Collections.Specialized;
using System.Web.Configuration;
using System.Web.Util;
using System.Web.Security;
using System.Web.Compilation;
using System.Configuration;
using System.Configuration.Provider;
using System.Reflection;
using System.CodeDom;
[Serializable]
[AspNetHostingPermission(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)]
public class ProfileInfo
{
public ProfileInfo(string username, bool isAnonymous, DateTime lastActivityDate, DateTime lastUpdatedDate, int size)
{
if( username != null )
{
username = username.Trim();
}
_UserName = username;
if (lastActivityDate.Kind == DateTimeKind.Local) {
lastActivityDate = lastActivityDate.ToUniversalTime();
}
_LastActivityDate = lastActivityDate;
if (lastUpdatedDate.Kind == DateTimeKind.Local) {
lastUpdatedDate = lastUpdatedDate.ToUniversalTime();
}
_LastUpdatedDate = lastUpdatedDate;
_IsAnonymous = isAnonymous;
_Size = size;
}
protected ProfileInfo() { }
public virtual string UserName { get { return _UserName;} }
public virtual DateTime LastActivityDate { get { return _LastActivityDate.ToLocalTime();} }
public virtual DateTime LastUpdatedDate { get { return _LastUpdatedDate.ToLocalTime(); } }
public virtual bool IsAnonymous { get { return _IsAnonymous;} }
public virtual int Size { get { return _Size; } }
private string _UserName;
private DateTime _LastActivityDate;
private DateTime _LastUpdatedDate;
private bool _IsAnonymous;
private int _Size;
}
[Serializable]
[AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)]
public sealed class ProfileInfoCollection : IEnumerable, ICollection
{
private Hashtable _Hashtable = null;
private ArrayList _ArrayList = null;
private bool _ReadOnly = false;
private int _CurPos = 0;
private int _NumBlanks = 0;
public ProfileInfoCollection() {
_Hashtable = new Hashtable(10, StringComparer.CurrentCultureIgnoreCase);
_ArrayList = new ArrayList();
}
public void Add(ProfileInfo profileInfo)
{
if (_ReadOnly)
throw new NotSupportedException();
if (profileInfo == null || profileInfo.UserName == null)
throw new ArgumentNullException( "profileInfo" );
_Hashtable.Add(profileInfo.UserName, _CurPos);
_ArrayList.Add(profileInfo);
_CurPos++;
}
public void Remove(string name)
{
if (_ReadOnly)
throw new NotSupportedException();
object pos = _Hashtable[name];
if (pos == null)
return;
_Hashtable.Remove(name);
_ArrayList[(int)pos] = null;
_NumBlanks++;
}
public ProfileInfo this[string name]
{
get {
object pos = _Hashtable[name];
if (pos == null)
return null;
return _ArrayList[(int)pos] as ProfileInfo;
}
}
public IEnumerator GetEnumerator() {
DoCompact();
return _ArrayList.GetEnumerator();
}
public void SetReadOnly() {
if (_ReadOnly)
return;
_ReadOnly = true;
}
public void Clear() {
if (_ReadOnly)
throw new NotSupportedException();
_Hashtable.Clear();
_ArrayList.Clear();
_CurPos = 0;
_NumBlanks = 0;
}
public int Count { get { return _Hashtable.Count; } }
public bool IsSynchronized {get { return false;}}
public object SyncRoot {get { return this;}}
public void CopyTo(Array array, int index)
{
DoCompact();
_ArrayList.CopyTo(array, index);
}
public void CopyTo(ProfileInfo [] array, int index)
{
DoCompact();
_ArrayList.CopyTo(array, index);
}
private void DoCompact() {
if (_NumBlanks < 1)
return;
ArrayList al = new ArrayList(_CurPos - _NumBlanks);
int firstBlankPos = -1;
for (int iter = 0; iter < _CurPos; iter++) {
if (_ArrayList[iter] != null)
al.Add(_ArrayList[iter]);
else if (firstBlankPos == -1)
firstBlankPos = iter;
}
_NumBlanks = 0;
_ArrayList = al;
_CurPos = _ArrayList.Count;
for (int iter = firstBlankPos; iter < _CurPos; iter++) {
ProfileInfo profileInfo = _ArrayList[iter] as ProfileInfo;
_Hashtable[profileInfo.UserName] = iter;
}
}
}
}
// 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
- OptimizedTemplateContentHelper.cs
- AsymmetricSignatureFormatter.cs
- basevalidator.cs
- TemplateInstanceAttribute.cs
- DataGridTextColumn.cs
- ErrorHandlerModule.cs
- DescriptionAttribute.cs
- ProcessHostFactoryHelper.cs
- OrderedDictionaryStateHelper.cs
- CacheDependency.cs
- SendReply.cs
- MatrixConverter.cs
- UnsafeNativeMethodsTablet.cs
- WmlValidatorAdapter.cs
- IdentityNotMappedException.cs
- ProviderCollection.cs
- TypeGeneratedEventArgs.cs
- CheckBoxAutomationPeer.cs
- HostingEnvironmentSection.cs
- CombinedTcpChannel.cs
- DragCompletedEventArgs.cs
- InputReport.cs
- TableLayoutCellPaintEventArgs.cs
- SoapException.cs
- TimelineClockCollection.cs
- SpecularMaterial.cs
- SharedUtils.cs
- DataSourceSerializationException.cs
- DesignerRegionCollection.cs
- SystemUdpStatistics.cs
- SingleTagSectionHandler.cs
- ProfessionalColorTable.cs
- NamespaceInfo.cs
- BypassElement.cs
- XmlObjectSerializer.cs
- CompositeActivityMarkupSerializer.cs
- CodeTypeOfExpression.cs
- Tokenizer.cs
- Stack.cs
- PropertyGeneratedEventArgs.cs
- TakeOrSkipQueryOperator.cs
- DataMemberAttribute.cs
- PersistenceProviderFactory.cs
- DefaultParameterValueAttribute.cs
- ThreadAttributes.cs
- Section.cs
- PointAnimationBase.cs
- QueryExpression.cs
- WebPartVerbsEventArgs.cs
- AutoResetEvent.cs
- AnimationClock.cs
- Part.cs
- RectAnimation.cs
- MappingItemCollection.cs
- RNGCryptoServiceProvider.cs
- SymLanguageVendor.cs
- _OSSOCK.cs
- StringOutput.cs
- DataGridViewAutoSizeColumnModeEventArgs.cs
- ObjectItemConventionAssemblyLoader.cs
- Run.cs
- NativeMethods.cs
- SqlClientWrapperSmiStreamChars.cs
- OperationFormatUse.cs
- datacache.cs
- AmbiguousMatchException.cs
- DockEditor.cs
- PlatformNotSupportedException.cs
- ObjectStateEntryDbDataRecord.cs
- InternalTypeHelper.cs
- ResourceDictionary.cs
- SqlDataAdapter.cs
- TextBox.cs
- FixUp.cs
- ToolBarButton.cs
- EntityConnection.cs
- UriScheme.cs
- basemetadatamappingvisitor.cs
- WebBrowsableAttribute.cs
- login.cs
- XmlSchemaValidationException.cs
- ParallelTimeline.cs
- OrderedDictionary.cs
- _DomainName.cs
- XmlElementAttributes.cs
- Configuration.cs
- Point.cs
- LogicalCallContext.cs
- MouseButton.cs
- ListDictionary.cs
- ConfigXmlCDataSection.cs
- IntSecurity.cs
- DesignerVerbCollection.cs
- WebRequestModuleElementCollection.cs
- QueryReaderSettings.cs
- RelatedCurrencyManager.cs
- SQLSingleStorage.cs
- TextRunCache.cs
- InstallerTypeAttribute.cs
- SelfIssuedSamlTokenFactory.cs