Skip to main content

ProfileCollection

  • Namespace: PPDS.Auth.Profiles
  • Assembly: PPDS.Auth
  • Kind: Class

Summary

Collection of authentication profiles with active profile tracking.

Members

Methods

Add

void Add(AuthProfile profile, bool setAsActive)

Adds a profile to the collection.

  • Param profile: The profile to add.

  • Param setAsActive: Whether to set this as the active profile.

Clear

void Clear()

Clears all profiles.

Clone

ProfileCollection Clone()

Creates a deep copy of this collection with all profiles cloned.

GetByIndex

AuthProfile GetByIndex(int index)

Gets a profile by index.

  • Param index: The profile index.

  • Returns: The profile, or null if not found.

GetByName

AuthProfile GetByName(string name)

Gets a profile by name (case-insensitive).

  • Param name: The profile name.

  • Returns: The profile, or null if not found.

GetByNameOrIndex

AuthProfile GetByNameOrIndex(string nameOrIndex)

Gets a profile by name or index string.

  • Param nameOrIndex: The profile name or index (as string), including bracket notation like "[1]" or full DisplayIdentifier like "[1] MyProfile".

  • Returns: The profile, or null if not found.

IsNameInUse

bool IsNameInUse(string name, Nullable<int> excludeIndex)

Checks if a profile name is already in use (case-insensitive).

  • Param name: The name to check.

  • Param excludeIndex: Optional index to exclude from check (for rename).

  • Returns: True if the name is in use.

RemoveByIndex

bool RemoveByIndex(int index)

Removes a profile by index.

  • Param index: The profile index.

  • Returns: True if removed, false if not found.

RemoveByName

bool RemoveByName(string name)

Removes a profile by name.

  • Param name: The profile name.

  • Returns: True if removed, false if not found.

SetActiveByIndex

void SetActiveByIndex(int index)

Sets the active profile by index.

  • Param index: The profile index.

SetActiveByName

void SetActiveByName(string name)

Sets the active profile by name.

  • Param name: The profile name.

Properties

ActiveProfile

AuthProfile ActiveProfile { get; }

Gets the active profile, or null if none is active.

ActiveProfileIndex

Nullable<int> ActiveProfileIndex { get; set; }

Gets or sets the index of the active profile. Primary tracking mechanism.

ActiveProfileName

string ActiveProfileName { get; set; }

Gets or sets the name of the active profile. Kept for backwards compatibility with v2 profiles.json files and for display purposes.

All

IEnumerable<AuthProfile> All { get; }

Gets all profiles in index order.

Count

int Count { get; }

Gets the count of profiles.

NextIndex

int NextIndex { get; }

Gets the next available index.

Profiles

List<AuthProfile> Profiles { get; set; }

Gets or sets the profiles list.

Version

int Version { get; set; }

Storage format version. v2 uses array storage and index-based active profile tracking.