C# Класс AutoQuery.Systems.Profile

Наследование: IProfile
Показать файл Открыть проект

Открытые методы

Метод Описание
Clone ( ) : object

Retrieves a copy of itself.

This method needs to be implemented by derived classes.

CloneReadOnly ( ) : IReadOnlyProfile

Retrieves a copy of itself and makes it read-only.

This method serves as a convenient way to pass a read-only copy of the profile to methods that are not allowed to modify it.

GetDataSet ( ) : DataSet

Retrieves a DataSet object containing every section, entry, and value in the profile.

The returned DataSet will be named using the Name property. It will contain one table for each section, and each entry will be represented by a column inside the table. Each table will contain only one row where the values will stored corresponding to each column (entry).

This method serves as a convenient way to extract the profile's data to this generic medium known as the DataSet. This allows it to be moved to many different places, including a different type of profile object (eg., INI to XML conversion).

This method calls GetSectionNames, GetEntryNames, and GetValue of the derived class, so check the documentation to see what other exceptions may be raised.

GetEntryNames ( string section ) : string[]

Retrieves the names of all the entries inside a section.

This method needs to be implemented by derived classes. Check the documentation to see what other exceptions derived versions may raise.

GetSectionNames ( ) : string[]

Retrieves the names of all the sections.

This method needs to be implemented by derived classes. Check the documentation to see what exceptions derived versions may raise.

GetValue ( string section, string entry, bool defaultValue ) : bool

Retrieves the bool value of an entry inside a section, or a default value if the entry does not exist.

Note: Boolean values are stored as "True" or "False".

This method calls GetValue(section, entry) of the derived class, so check its documentation to see what other exceptions may be raised.

GetValue ( string section, string entry, double defaultValue ) : double

Retrieves the double value of an entry inside a section, or a default value if the entry does not exist.

This method calls GetValue(section, entry) of the derived class, so check its documentation to see what other exceptions may be raised.

GetValue ( string section, string entry, int defaultValue ) : int

Retrieves the integer value of an entry inside a section, or a default value if the entry does not exist.

This method calls GetValue(section, entry) of the derived class, so check its documentation to see what other exceptions may be raised.

GetValue ( string section, string entry ) : object

Retrieves the value of an entry inside a section.

This method needs to be implemented by derived classes. Check the documentation to see what other exceptions derived versions may raise.

GetValue ( string section, string entry, string defaultValue ) : string

Retrieves the string value of an entry inside a section, or a default value if the entry does not exist.

This method calls GetValue(section, entry) of the derived class, so check its documentation to see what other exceptions may be raised.

HasEntry ( string section, string entry ) : bool

Determines if an entry exists inside a section.

This method calls GetEntryNames of the derived class, so check its documentation to see what other exceptions may be raised.

HasSection ( string section ) : bool

Determines if a section exists.

RemoveEntry ( string section, string entry ) : void

Removes an entry from a section.

This method needs to be implemented by derived classes. Check the documentation to see what other exceptions derived versions may raise. See IProfile.RemoveEntry for additional remarks.

RemoveSection ( string section ) : void

Removes a section.

This method needs to be implemented by derived classes. Check the documentation to see what other exceptions derived versions may raise. See IProfile.RemoveSection for additional remarks.

SetDataSet ( DataSet ds ) : void

Writes the data of every table from a DataSet into this profile.

Each table in the DataSet represents a section of the profile. Each column of each table represents an entry. And for each column, the corresponding value of the first row is the value to be passed to SetValue. Note that only the first row is imported; additional rows are ignored.

This method serves as a convenient way to take any data inside a generic DataSet and write it to any of the available profiles.

This method calls SetValue of the derived class, so check its documentation to see what other exceptions may be raised.

SetValue ( string section, string entry, object value ) : void

Sets the value for an entry inside a section.

This method needs to be implemented by derived classes. Check the documentation to see what other exceptions derived versions may raise. See IProfile.SetValue for additional remarks.

Защищенные методы

Метод Описание
OnChanged ( ProfileChangedArgs e ) : void

Raises the Changed event.

This method should be invoked after a change to the profile has been made so that the Changed event is raised, giving a chance to the handlers to be notified of the change.

OnChanging ( ProfileChangingArgs e ) : void

Raises the Changing event.

This method should be invoked prior to making a change to the profile so that the Changing event is raised, giving a chance to the handlers to prevent the change from happening (by setting e.Cancel to true). This method calls each individual handler associated with the Changing event and checks the resulting e.Cancel flag. If it's true, it stops and does not call of any remaining handlers since the change needs to be prevented anyway.

Profile ( ) : System

Initializes a new instance of the Profile class by setting the Name to DefaultName.

Profile ( Profile profil ) : System

Initializes a new instance of the Profile class based on another Profile object.

Profile ( string name ) : System

Initializes a new instance of the Profile class by setting the Name to a value.

RaiseChangeEvent ( bool changing, ProfileChangeType changeType, string section, string entry, object value ) : bool

Raises either the Changing or Changed event.

This method may be used by derived classes as a convenient alternative to calling OnChanging and OnChanged. For example, a typical call to OnChanging would require four lines of code, which this method reduces to two.

VerifyAndAdjustEntry ( string &entry ) : void

Verifies the given entry name is not null and trims it.

This method may be used by derived classes to make sure that a valid entry name has been passed, and to make any necessary adjustments to it before passing it to the corresponding APIs.

VerifyAndAdjustSection ( string &section ) : void

Verifies the given section name is not null and trims it.

This method may be used by derived classes to make sure that a valid section name has been passed, and to make any necessary adjustments to it before passing it to the corresponding APIs.

VerifyName ( ) : void

Verifies the Name property is not empty or null.

This method may be used by derived classes to make sure that the APIs are working with a valid Name (file name)

VerifyNotReadOnly ( ) : void

Verifies the ReadOnly property is not true.

This method may be used by derived classes as a convenient way to validate that modifications to the profile can be made.

Описание методов

Clone() публичный абстрактный Метод

Retrieves a copy of itself.
This method needs to be implemented by derived classes.
public abstract Clone ( ) : object
Результат object

CloneReadOnly() публичный Метод

Retrieves a copy of itself and makes it read-only.
This method serves as a convenient way to pass a read-only copy of the profile to methods that are not allowed to modify it.
public CloneReadOnly ( ) : IReadOnlyProfile
Результат IReadOnlyProfile

GetDataSet() публичный Метод

Retrieves a DataSet object containing every section, entry, and value in the profile.
The returned DataSet will be named using the Name property. It will contain one table for each section, and each entry will be represented by a column inside the table. Each table will contain only one row where the values will stored corresponding to each column (entry).

This method serves as a convenient way to extract the profile's data to this generic medium known as the DataSet. This allows it to be moved to many different places, including a different type of profile object (eg., INI to XML conversion).

This method calls GetSectionNames, GetEntryNames, and GetValue of the derived class, so check the documentation to see what other exceptions may be raised.

/// is null or empty.
public GetDataSet ( ) : DataSet
Результат System.Data.DataSet

GetEntryNames() публичный абстрактный Метод

Retrieves the names of all the entries inside a section.
This method needs to be implemented by derived classes. Check the documentation to see what other exceptions derived versions may raise.
/// section is null.
public abstract GetEntryNames ( string section ) : string[]
section string /// The name of the section holding the entries.
Результат string[]

GetSectionNames() публичный абстрактный Метод

Retrieves the names of all the sections.
This method needs to be implemented by derived classes. Check the documentation to see what exceptions derived versions may raise.
public abstract GetSectionNames ( ) : string[]
Результат string[]

GetValue() публичный Метод

Retrieves the bool value of an entry inside a section, or a default value if the entry does not exist.
Note: Boolean values are stored as "True" or "False".

This method calls GetValue(section, entry) of the derived class, so check its documentation to see what other exceptions may be raised.

/// is null or empty. /// Either section or entry is null.
public GetValue ( string section, string entry, bool defaultValue ) : bool
section string /// The name of the section that holds the entry with the value.
entry string /// The name of the entry where the value is stored.
defaultValue bool /// The value to return if the entry (or section) does not exist.
Результат bool

GetValue() публичный Метод

Retrieves the double value of an entry inside a section, or a default value if the entry does not exist.
This method calls GetValue(section, entry) of the derived class, so check its documentation to see what other exceptions may be raised.
/// is null or empty. /// Either section or entry is null.
public GetValue ( string section, string entry, double defaultValue ) : double
section string /// The name of the section that holds the entry with the value.
entry string /// The name of the entry where the value is stored.
defaultValue double /// The value to return if the entry (or section) does not exist.
Результат double

GetValue() публичный Метод

Retrieves the integer value of an entry inside a section, or a default value if the entry does not exist.
This method calls GetValue(section, entry) of the derived class, so check its documentation to see what other exceptions may be raised.
/// is null or empty. /// Either section or entry is null.
public GetValue ( string section, string entry, int defaultValue ) : int
section string /// The name of the section that holds the entry with the value.
entry string /// The name of the entry where the value is stored.
defaultValue int /// The value to return if the entry (or section) does not exist.
Результат int

GetValue() публичный абстрактный Метод

Retrieves the value of an entry inside a section.
This method needs to be implemented by derived classes. Check the documentation to see what other exceptions derived versions may raise.
/// is null or empty. /// Either section or entry is null.
public abstract GetValue ( string section, string entry ) : object
section string /// The name of the section that holds the entry with the value.
entry string /// The name of the entry where the value is stored.
Результат object

GetValue() публичный Метод

Retrieves the string value of an entry inside a section, or a default value if the entry does not exist.
This method calls GetValue(section, entry) of the derived class, so check its documentation to see what other exceptions may be raised.
/// is null or empty. /// Either section or entry is null.
public GetValue ( string section, string entry, string defaultValue ) : string
section string /// The name of the section that holds the entry with the value.
entry string /// The name of the entry where the value is stored.
defaultValue string /// The value to return if the entry (or section) does not exist.
Результат string

HasEntry() публичный Метод

Determines if an entry exists inside a section.
This method calls GetEntryNames of the derived class, so check its documentation to see what other exceptions may be raised.
/// section is null.
public HasEntry ( string section, string entry ) : bool
section string /// The name of the section that holds the entry.
entry string /// The name of the entry to be checked for existence.
Результат bool

HasSection() публичный Метод

Determines if a section exists.
public HasSection ( string section ) : bool
section string /// The name of the section to be checked for existence.
Результат bool

OnChanged() защищенный Метод

Raises the Changed event.
This method should be invoked after a change to the profile has been made so that the Changed event is raised, giving a chance to the handlers to be notified of the change.
protected OnChanged ( ProfileChangedArgs e ) : void
e ProfileChangedArgs /// The arguments object associated with the Changed event.
Результат void

OnChanging() защищенный Метод

Raises the Changing event.
This method should be invoked prior to making a change to the profile so that the Changing event is raised, giving a chance to the handlers to prevent the change from happening (by setting e.Cancel to true). This method calls each individual handler associated with the Changing event and checks the resulting e.Cancel flag. If it's true, it stops and does not call of any remaining handlers since the change needs to be prevented anyway.
protected OnChanging ( ProfileChangingArgs e ) : void
e ProfileChangingArgs /// The arguments object associated with the Changing event.
Результат void

Profile() защищенный Метод

Initializes a new instance of the Profile class by setting the Name to DefaultName.
protected Profile ( ) : System
Результат System

Profile() защищенный Метод

Initializes a new instance of the Profile class based on another Profile object.
protected Profile ( Profile profil ) : System
profil Profile
Результат System

Profile() защищенный Метод

Initializes a new instance of the Profile class by setting the Name to a value.
protected Profile ( string name ) : System
name string /// The name to initialize the property with.
Результат System

RaiseChangeEvent() защищенный Метод

Raises either the Changing or Changed event.
This method may be used by derived classes as a convenient alternative to calling OnChanging and OnChanged. For example, a typical call to OnChanging would require four lines of code, which this method reduces to two.
protected RaiseChangeEvent ( bool changing, ProfileChangeType changeType, string section, string entry, object value ) : bool
changing bool /// If true, the Changing event is raised otherwise it's Changed.
changeType ProfileChangeType /// The type of change being made.
section string /// The name of the section that was involved in the change or null if not applicable.
entry string /// The name of the entry that was involved in the change or null if not applicable. /// If changeType is equal to Other, entry is the name of the property involved in the change.
value object /// The value that was changed or null if not applicable.
Результат bool

RemoveEntry() публичный абстрактный Метод

Removes an entry from a section.
This method needs to be implemented by derived classes. Check the documentation to see what other exceptions derived versions may raise. See IProfile.RemoveEntry for additional remarks.
/// is true. /// Either section or entry is null.
public abstract RemoveEntry ( string section, string entry ) : void
section string /// The name of the section that holds the entry.
entry string /// The name of the entry to remove.
Результат void

RemoveSection() публичный абстрактный Метод

Removes a section.
This method needs to be implemented by derived classes. Check the documentation to see what other exceptions derived versions may raise. See IProfile.RemoveSection for additional remarks.
/// is true. /// section is null.
public abstract RemoveSection ( string section ) : void
section string /// The name of the section to remove.
Результат void

SetDataSet() публичный Метод

Writes the data of every table from a DataSet into this profile.
Each table in the DataSet represents a section of the profile. Each column of each table represents an entry. And for each column, the corresponding value of the first row is the value to be passed to SetValue. Note that only the first row is imported; additional rows are ignored.

This method serves as a convenient way to take any data inside a generic DataSet and write it to any of the available profiles.

This method calls SetValue of the derived class, so check its documentation to see what other exceptions may be raised.

/// is true or /// is null or empty. /// ds is null.
public SetDataSet ( DataSet ds ) : void
ds System.Data.DataSet /// The DataSet object containing the data to be set.
Результат void

SetValue() публичный абстрактный Метод

Sets the value for an entry inside a section.
This method needs to be implemented by derived classes. Check the documentation to see what other exceptions derived versions may raise. See IProfile.SetValue for additional remarks.
/// is true or /// is null or empty. /// Either section or entry is null.
public abstract SetValue ( string section, string entry, object value ) : void
section string /// The name of the section that holds the entry.
entry string /// The name of the entry where the value will be set.
value object /// The value to set. If it's null, the entry should be removed.
Результат void

VerifyAndAdjustEntry() защищенный Метод

Verifies the given entry name is not null and trims it.
This method may be used by derived classes to make sure that a valid entry name has been passed, and to make any necessary adjustments to it before passing it to the corresponding APIs.
/// entry is null.
protected VerifyAndAdjustEntry ( string &entry ) : void
entry string /// The entry name to verify and adjust.
Результат void

VerifyAndAdjustSection() защищенный Метод

Verifies the given section name is not null and trims it.
This method may be used by derived classes to make sure that a valid section name has been passed, and to make any necessary adjustments to it before passing it to the corresponding APIs.
/// section is null.
protected VerifyAndAdjustSection ( string &section ) : void
section string /// The section name to verify and adjust.
Результат void

VerifyName() защищенный Метод

Verifies the Name property is not empty or null.
This method may be used by derived classes to make sure that the APIs are working with a valid Name (file name)
/// name is empty or null.
protected VerifyName ( ) : void
Результат void

VerifyNotReadOnly() защищенный Метод

Verifies the ReadOnly property is not true.
This method may be used by derived classes as a convenient way to validate that modifications to the profile can be made.
/// ReadOnly is true.
protected VerifyNotReadOnly ( ) : void
Результат void