Merge branch 'YannBrulhart-master'

* YannBrulhart-master:
  Added bunch of interfaces (IO, Net, X509, Xml, Data, ActiveDirectory)
  IStreamWriter derives from IDisposable - allows seamless usage in using statements
This commit is contained in:
Jozef Izso 2016-01-30 11:18:10 +01:00
Родитель 65586421bd 03462e1000
Коммит e067945c06
163 изменённых файлов: 24670 добавлений и 1 удалений

1
GenerateFactories.bat Normal file
Просмотреть файл

@ -0,0 +1 @@
@call "%~dp0\.\packages\DeveloperInTheFlow.FactoryGenerator.2.0.0.1\tools\FactoryGenerator.exe" %*

Просмотреть файл

@ -0,0 +1,76 @@
namespace SystemInterface.ActiveDirectory
{
using System;
using System.DirectoryServices;
/// <summary>
///
/// </summary>
public interface IDirectoryEntry : IDisposable
{
#region Public Properties
/// <summary>
///
/// </summary>
Guid Guid { get; }
/// <summary>
///
/// </summary>
string Name { get; }
/// <summary>
///
/// </summary>
string NativeGuid { get; }
/// <summary>
///
/// </summary>
string Password { set; }
/// <summary>
///
/// </summary>
string Path { get; }
/// <summary>
///
/// </summary>
string SchemaClassName { get; }
/// <summary>
///
/// </summary>
string Username { get; }
#endregion
#region Public Methods and Operators
/// <summary>
///
/// </summary>
void Close();
/// <summary>
///
/// </summary>
void CommitChanges();
/// <summary>
///
/// </summary>
void DeleteTree();
/// <summary>
///
/// </summary>
/// <returns>
/// </returns>
DirectoryEntry GetDirectoryEntry();
#endregion
}
}

Просмотреть файл

@ -0,0 +1,19 @@
namespace SystemInterface.ActiveDirectory
{
/// <summary>
///
/// </summary>
public interface IDirectoryEntryFactory
{
#region Public Methods and Operators
/// <summary>
///
/// </summary>
/// <param name="forestGc"></param>
/// <returns></returns>
IDirectoryEntry Create(string forestGc);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,66 @@
namespace SystemInterface.ActiveDirectory
{
using System;
using System.Collections.Specialized;
/// <summary>
///
/// </summary>
public interface IDirectorySearcher : IDisposable
{
#region Public Properties
/// <summary>
///
/// </summary>
/// <returns>
/// </returns>
bool CacheResults { get; set; }
/// <summary>
///
/// </summary>
string Filter { get; set; }
/// <summary>
///
/// </summary>
/// <returns>
/// </returns>
int PageSize { get; set; }
/// <summary>
///
/// </summary>
/// <returns>
/// </returns>
StringCollection PropertiesToLoad { get; }
/// <summary>
///
/// </summary>
/// <returns>
/// </returns>
int SizeLimit { get; set; }
#endregion
#region Public Methods and Operators
/// <summary>
///
/// </summary>
/// <returns>
/// </returns>
ISearchResultCollection FindAll();
/// <summary>
///
/// </summary>
/// <returns>
/// </returns>
ISearchResult FindOne();
#endregion
}
}

Просмотреть файл

@ -0,0 +1,27 @@
namespace SystemInterface.ActiveDirectory
{
/// <summary>
///
/// </summary>
public interface IDirectorySearcherFactory
{
#region Public Methods and Operators
/// <summary>
///
/// </summary>
/// <param name="directoryEntry">
/// </param>
/// <param name="pageSize">
/// </param>
/// <param name="sizeLimit">
/// </param>
/// <returns>
/// </returns>
IDirectorySearcher Create(IDirectoryEntry directoryEntry,
int sizeLimit = 20,
int? pageSize = null);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,54 @@
namespace SystemInterface.ActiveDirectory
{
using System.Collections;
/// <summary>
///
/// </summary>
public interface IResultPropertyCollection : ICollection
{
#region Public Properties
/// <summary>
/// Gets the names of the properties in this collection.
/// </summary>
ICollection PropertyNames { get; }
/// <summary>
/// Gets the values of the properties in this collection.
/// </summary>
ICollection Values { get; }
#endregion
#region Public Indexers
/// <summary>
/// Determines whether the property that has the specified name belongs to this
/// collection.
/// </summary>
/// <param name="name">
/// The name of the property to get.
/// </param>
IResultPropertyValueCollection this[string name] { get; }
#endregion
#region Public Methods and Operators
/// <summary>
/// Determines whether the property that has the specified name belongs to this
/// collection.
/// </summary>
/// <param name="propertyName">
/// The name of the property to find.
/// </param>
/// <returns>
/// The return value is true if the specified property belongs to this collection;
/// otherwise, false.
/// </returns>
bool Contains(string propertyName);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,67 @@
namespace SystemInterface.ActiveDirectory
{
using System.Collections;
/// <summary>
///
/// </summary>
public interface IResultPropertyValueCollection : ICollection
{
#region Public Indexers
/// <summary>
/// The System.DirectoryServices.ResultPropertyValueCollectionWrap.this[System.Int32]
/// property gets the property value that is located at a specified index.
/// </summary>
/// <param name="index">
/// The zero-based index of the property value to retrieve.
/// </param>
object this[int index] { get; }
#endregion
#region Public Methods and Operators
/// <summary>
/// The System.DirectoryServices.ResultPropertyValueCollectionWrap.Contains(System.Object)
/// method determines whether a specified property value is in this collection.
/// </summary>
/// <param name="value">
/// The property value to find.
/// </param>
/// <returns>
/// The return value is true if the specified property belongs to this collection;
/// otherwise, false.
/// </returns>
bool Contains(object value);
/// <summary>
/// The System.DirectoryServices.ResultPropertyValueCollectionWrap.CopyTo(System.Object[],System.Int32)
/// method copies the property values from this collection to an array, starting
/// at a particular index of the array.
/// </summary>
/// <param name="values">
/// An array of type System.Object that receives this collection's property values.
/// </param>
/// <param name="index">
/// The zero-based array index at which to begin copying the property values.
/// </param>
void CopyTo(object[] values,
int index);
/// <summary>
/// The System.DirectoryServices.ResultPropertyValueCollectionWrap.IndexOf(System.Object)
/// method retrieves the index of a specified property value in this collection.
/// </summary>
/// <param name="value">
/// The property value to find.
/// </param>
/// <returns>
/// The zero-based index of the specified property value. If the object is not
/// found, the return value is -1.
/// </returns>
int IndexOf(object value);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,35 @@
namespace SystemInterface.ActiveDirectory
{
using System.DirectoryServices;
/// <summary>
///
/// </summary>
public interface ISearchResult
{
#region Public Properties
/// <summary>
///
/// </summary>
IResultPropertyCollection Properties { get; }
#endregion
#region Public Methods and Operators
/// <summary>
///
/// </summary>
/// <returns></returns>
IDirectoryEntry GetDirectoryEntry();
/// <summary>
///
/// </summary>
/// <returns></returns>
SearchResult GetSearchResult();
#endregion
};
}

Просмотреть файл

@ -0,0 +1,26 @@
namespace SystemInterface.ActiveDirectory
{
using System;
using System.Collections.Generic;
/// <summary>
///
/// </summary>
public interface ISearchResultCollection : ICollection<ISearchResult>,
IDisposable
{
#region Public Indexers
/// <summary>
/// Gets the <see cref="T:System.DirectoryServices.SearchResult"/> object that is located at a specified index in this collection.
/// </summary>
///
/// <returns>
/// The <see cref="T:System.DirectoryServices.SearchResult"/> object that is located at the specified index.
/// </returns>
/// <param name="index">The zero-based index of the <see cref="T:System.DirectoryServices.SearchResult"/> object to retrieve.</param>
ISearchResult this[int index] { get; }
#endregion
}
}

Просмотреть файл

@ -0,0 +1,37 @@
namespace SystemInterface.Attributes
{
using System;
using System.Diagnostics.CodeAnalysis;
/// <summary>
/// The attribute used to mark classes which will receive an automatically generated factory implementation, based on a specified contract.
/// </summary>
[AttributeUsage(AttributeTargets.Class)]
[ExcludeFromCodeCoverage]
public class GenerateFactoryAttribute : Attribute
{
#region Constructors and Destructors
/// <summary>
/// Initializes a new instance of the <see cref="GenerateFactoryAttribute" /> class.
/// </summary>
/// <param name="factoryContractType">
/// The type of the factory interface which will serve as the superclass to the generated factory implementation.
/// </param>
public GenerateFactoryAttribute(Type factoryContractType)
{
this.FactoryContractType = factoryContractType;
}
#endregion
#region Public Properties
/// <summary>
/// Gets the type of the factory interface which will serve as the superclass to the generated factory implementation.
/// </summary>
public Type FactoryContractType { get; private set; }
#endregion
}
}

Просмотреть файл

@ -0,0 +1,202 @@
namespace SystemInterface.Collections.Specialized
{
using System;
using System.Collections;
using System.Collections.Specialized;
/// <summary>
/// Wrapper for <see cref="T:System.Configuration.ConfigurationManager"/> class.
/// </summary>
public interface INameValueCollection
{
#region Public Properties
/// <summary>
/// Gets all the keys in the <see cref="T:System.Collections.Specialized.NameValueCollection"/>.
/// </summary>
/// <returns>
/// A <see cref="T:System.String"/> array that contains all the keys of the <see cref="T:System.Collections.Specialized.NameValueCollection"/>.
/// </returns>
string[] AllKeys { get; }
/// <summary>
/// Gets the number of key/value pairs contained in the <see cref="T:System.Collections.Specialized.NameObjectCollectionBase"/> instance.
/// </summary>
/// <returns>
/// The number of key/value pairs contained in the <see cref="T:System.Collections.Specialized.NameObjectCollectionBase"/> instance.
/// </returns>
int Count { get; }
/// <summary>
/// Returns a <see cref='System.Collections.Specialized.NameObjectCollectionBase.KeysCollection'/> instance containing all the keys
/// in the <see cref='System.Collections.Specialized.NameObjectCollectionBase'/> instance.
/// </summary>
NameObjectCollectionBase.KeysCollection Keys { get; }
#endregion
#region Public Indexers
/// <summary>
/// Gets or sets the entry with the specified key in the <see cref="T:System.Collections.Specialized.NameValueCollection"/>.
/// </summary>
/// <returns>
/// A <see cref="T:System.String"/> that contains the comma-separated list of values associated with the specified key, if found; otherwise, null.
/// </returns>
/// <param name="name">
/// The <see cref="T:System.String"/> key of the entry to locate. The key can be null.
/// </param>
/// <exception cref="T:System.NotSupportedException">
/// The collection is read-only and the operation attempts to modify the collection.
/// </exception>
string this[string name] { get; set; }
/// <summary>
/// Gets the entry at the specified index of the <see cref="T:System.Collections.Specialized.NameValueCollection"/>.
/// </summary>
/// <returns>
/// A <see cref="T:System.String"/> that contains the comma-separated list of values at the specified index of the collection.
/// </returns>
/// <param name="index">
/// The zero-based index of the entry to locate in the collection.
/// </param>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// <paramref name="index"/> is outside the valid range of indexes for the collection.
/// </exception>
string this[int index] { get; }
#endregion
#region Public Methods and Operators
/// <summary>
/// Copies the entries in the specified <see cref='System.Collections.Specialized.NameValueCollection'/> to the current <see cref='System.Collections.Specialized.NameValueCollection'/>.
/// </summary>
/// <param name="c">
/// The c.
/// </param>
void Add(NameValueCollection c);
/// <summary>
/// Adds an entry with the specified name and value into the <see cref='System.Collections.Specialized.NameValueCollection'/>.
/// </summary>
/// <param name="name">
/// The name.
/// </param>
/// <param name="value">
/// The value.
/// </param>
void Add(String name,
String value);
/// <summary>
/// Invalidates the cached arrays and removes all entries from the <see cref='System.Collections.Specialized.NameValueCollection'/>.
/// </summary>
void Clear();
void CopyTo(Array dest,
int index);
/// <summary>
/// Gets the values associated with the specified key from the <see cref='System.Collections.Specialized.NameValueCollection'/> combined into one comma-separated list.
/// </summary>
/// <param name="name">
/// The name.
/// </param>
/// <returns>
/// The <see cref="string"/>.
/// </returns>
String Get(String name);
/// <summary>
/// Gets the values at the specified index of the <see cref='System.Collections.Specialized.NameValueCollection'/> combined into one
/// comma-separated list.
/// </summary>
/// <param name="index">
/// The index.
/// </param>
/// <returns>
/// The <see cref="string"/>.
/// </returns>
String Get(int index);
/// <summary>
/// Returns an enumerator that can iterate through the <see cref='System.Collections.Specialized.NameObjectCollectionBase'/>.
/// </summary>
/// <returns>
/// The <see cref="IEnumerator"/>.
/// </returns>
IEnumerator GetEnumerator();
/// <summary>
/// Gets the key at the specified index of the <see cref='System.Collections.Specialized.NameValueCollection'/>.
/// </summary>
/// <param name="index">
/// The index.
/// </param>
/// <returns>
/// The <see cref="string"/>.
/// </returns>
String GetKey(int index);
/// <summary>
/// Gets the values associated with the specified key from the <see cref='System.Collections.Specialized.NameValueCollection'/>.
/// </summary>
/// <param name="name">
/// The name.
/// </param>
/// <returns>
/// The <see cref="string[]"/>.
/// </returns>
String[] GetValues(String name);
/// <summary>
/// Gets the values at the specified index of the <see cref='System.Collections.Specialized.NameValueCollection'/>.
/// </summary>
/// <param name="index">
/// The index.
/// </param>
/// <returns>
/// The <see cref="string[]"/>.
/// </returns>
String[] GetValues(int index);
/// <summary>
/// Gets a value indicating whether the <see cref='System.Collections.Specialized.NameValueCollection'/> contains entries whose keys are not <see langword='null'/>.
/// </summary>
/// <returns>
/// The <see cref="bool"/>.
/// </returns>
bool HasKeys();
/// <summary>
/// Removes the entries with the specified key from the <see cref='System.Collections.Specialized.NameObjectCollectionBase'/> instance.
/// </summary>
/// <param name="name">
/// The name.
/// </param>
void Remove(String name);
/// <summary>
/// Adds a value to an entry in the <see cref='System.Collections.Specialized.NameValueCollection'/>.
/// </summary>
/// <param name="name">
/// The name.
/// </param>
/// <param name="value">
/// The value.
/// </param>
void Set(String name,
String value);
/// <summary>
/// Returns a String which represents the object instance. The default for an object is to return the fully qualified name of the class.
/// </summary>
/// <returns>
/// The <see cref="string"/>.
/// </returns>
String ToString();
#endregion
}
}

Просмотреть файл

@ -0,0 +1,86 @@
namespace SystemInterface.Collections.Specialized
{
using System.Collections;
using System.Collections.Specialized;
/// <summary>
/// Factory that creates a new <see cref="INameValueCollection"/> instance.
/// </summary>
public interface INameValueCollectionFactory
{
#region Public Methods and Operators
/// <summary>
/// Creates a new <see cref="INameValueCollection"/> instance using the default constructor.
/// </summary>
/// <returns>
/// The <see cref="INameValueCollection"/>.
/// </returns>
INameValueCollection Create();
/// <summary>
/// Creates a new <see cref="INameValueCollection"/> instance passing the equality comparer.
/// </summary>
/// <param name="equalityComparer">
/// The equality comparer.
/// </param>
/// <returns>
/// The <see cref="INameValueCollection"/>.
/// </returns>
INameValueCollection Create(IEqualityComparer equalityComparer);
/// <summary>
/// Creates a new <see cref="INameValueCollection"/> instance passing the name value collection.
/// </summary>
/// <param name="col">
/// The col.
/// </param>
/// <returns>
/// The <see cref="INameValueCollection"/>.
/// </returns>
INameValueCollection Create(NameValueCollection col);
/// <summary>
/// Creates a new <see cref="INameValueCollection"/> instance passing the capacity.
/// </summary>
/// <param name="capacity">
/// The capacity.
/// </param>
/// <returns>
/// The <see cref="INameValueCollection"/>.
/// </returns>
INameValueCollection Create(int capacity);
/// <summary>
/// Creates a new <see cref="INameValueCollection"/> instance passing the capacity and the equality comparer.
/// </summary>
/// <param name="capacity">
/// The capacity.
/// </param>
/// <param name="equalityComparer">
/// The equality comparer.
/// </param>
/// <returns>
/// The <see cref="INameValueCollection"/>.
/// </returns>
INameValueCollection Create(int capacity,
IEqualityComparer equalityComparer);
/// <summary>
/// Creates a new <see cref="INameValueCollection"/> instance passing the capacity and the name value collection.
/// </summary>
/// <param name="capacity">
/// The capacity.
/// </param>
/// <param name="col">
/// The col.
/// </param>
/// <returns>
/// The <see cref="INameValueCollection"/>.
/// </returns>
INameValueCollection Create(int capacity,
NameValueCollection col);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,926 @@
namespace SystemInterface.Data.DataTable
{
using System;
using System.ComponentModel;
using System.Data;
using System.Globalization;
using System.IO;
using System.Runtime.Serialization;
using System.Xml;
/// <summary>
/// Wrapper for the <see cref="T:System.Data.DataTable.DataTable"/> class.
/// </summary>
public interface IDataTable
{
#region Public Events
/// <summary>
/// Occurs after a value has been changed for the specified <see cref="T:System.Data.DataColumn"/> in a <see cref="T:System.Data.DataRow"/>.
/// </summary>
event DataColumnChangeEventHandler ColumnChanged;
/// <summary>
/// Occurs when a value is being changed for the specified <see cref="T:System.Data.DataColumn"/> in a <see cref="T:System.Data.DataRow"/>.
/// </summary>
event DataColumnChangeEventHandler ColumnChanging;
/// <summary>
/// Occurs after the <see cref="T:System.Data.DataTable"/> is initialized.
/// </summary>
event EventHandler Initialized;
/// <summary>
/// Occurs after a <see cref="T:System.Data.DataRow"/> has been changed successfully.
/// </summary>
event DataRowChangeEventHandler RowChanged;
/// <summary>
/// Occurs when a <see cref="T:System.Data.DataRow"/> is changing.
/// </summary>
event DataRowChangeEventHandler RowChanging;
/// <summary>
/// Occurs after a row in the table has been deleted.
/// </summary>
event DataRowChangeEventHandler RowDeleted;
/// <summary>
/// Occurs before a row in the table is about to be deleted.
/// </summary>
event DataRowChangeEventHandler RowDeleting;
/// <summary>
/// Occurs after a <see cref="T:System.Data.DataTable"/> is cleared.
/// </summary>
event DataTableClearEventHandler TableCleared;
/// <summary>
/// Occurs when a <see cref="T:System.Data.DataTable"/> is cleared.
/// </summary>
event DataTableClearEventHandler TableClearing;
/// <summary>
/// Occurs when a new <see cref="T:System.Data.DataRow"/> is inserted.
/// </summary>
event DataTableNewRowEventHandler TableNewRow;
#endregion
#region Public Properties
/// <summary>
/// Indicates whether string comparisons within the table are case-sensitive.
/// </summary>
/// <returns>
/// true if the comparison is case-sensitive; otherwise false. The default is set to the parent <see cref="T:System.Data.DataSet"/>
/// object's <see cref="P:System.Data.DataSet.CaseSensitive"/> property, or false if the <see cref="T:System.Data.DataTable"/> was
/// created independently of a <see cref="T:System.Data.DataSet"/>.
/// </returns>
bool CaseSensitive { get; set; }
/// <summary>
/// Gets the collection of child relations for this <see cref="T:System.Data.DataTable"/>.
/// </summary>
/// <returns>
/// A <see cref="T:System.Data.DataRelationCollection"/> that contains the child relations for the table. An empty collection is
/// returned if no <see cref="T:System.Data.DataRelation"/> objects exist.
/// </returns>
DataRelationCollection ChildRelations { get; }
/// <summary>
/// Gets the collection of columns that belong to this table.
/// </summary>
/// <returns>
/// A <see cref="T:System.Data.DataColumnCollection"/> that contains the collection of <see cref="T:System.Data.DataColumn"/>
/// objects for the table. An empty collection is returned if no <see cref="T:System.Data.DataColumn"/> objects exist.
/// </returns>
DataColumnCollection Columns { get; }
/// <summary>
/// Gets the collection of constraints maintained by this table.
/// </summary>
/// <returns>
/// A <see cref="T:System.Data.ConstraintCollection"/> that contains the collection of <see cref="T:System.Data.Constraint"/>
/// objects for the table. An empty collection is returned if no <see cref="T:System.Data.Constraint"/> objects exist.
/// </returns>
ConstraintCollection Constraints { get; }
/// <summary>
/// Gets the <see cref="T:System.Data.DataSet"/> to which this table belongs.
/// </summary>
/// <returns>
/// The <see cref="T:System.Data.DataSet"/> to which this table belongs.
/// </returns>
DataSet DataSet { get; }
/// <summary>
/// Gets the data table instance.
/// </summary>
DataTable DataTableInstance { get; }
/// <summary>
/// Gets a customized view of the table that may include a filtered view, or a cursor position.
/// </summary>
/// <returns>
/// The <see cref="T:System.Data.DataView"/> associated with the <see cref="T:System.Data.DataTable"/>.
/// </returns>
DataView DefaultView { get; }
/// <summary>
/// Gets or sets the expression that returns a value used to represent this table in the user interface. The DisplayExpression property
/// lets you display the name of this table in a user interface.
/// </summary>
/// <returns>
/// A display string.
/// </returns>
string DisplayExpression { get; set; }
/// <summary>
/// Gets the collection of customized user information.
/// </summary>
/// <returns>
/// A <see cref="T:System.Data.PropertyCollection"/> that contains custom user information.
/// </returns>
PropertyCollection ExtendedProperties { get; }
/// <summary>
/// Gets a value indicating whether there are errors in any of the rows in any of the tables of the <see cref="T:System.Data.DataSet"/> to which the table belongs.
/// </summary>
/// <returns>
/// true if errors exist; otherwise false.
/// </returns>
bool HasErrors { get; }
/// <summary>
/// Gets a value that indicates whether the <see cref="T:System.Data.DataTable"/> is initialized.
/// </summary>
/// <returns>
/// true to indicate the component has completed initialization; otherwise false.
/// </returns>
bool IsInitialized { get; }
/// <summary>
/// Gets or sets the locale information used to compare strings within the table.
/// </summary>
/// <returns>
/// A <see cref="T:System.Globalization.CultureInfo"/> that contains data about the user's machine locale. The default is the
/// <see cref="T:System.Data.DataSet"/> object's <see cref="T:System.Globalization.CultureInfo"/> (returned by the
/// <see cref="P:System.Data.DataSet.Locale"/> property) to which the <see cref="T:System.Data.DataTable"/> belongs; if the table
/// doesn't belong to a <see cref="T:System.Data.DataSet"/>, the default is the current system <see cref="T:System.Globalization.CultureInfo"/>.
/// </returns>
CultureInfo Locale { get; set; }
/// <summary>
/// Gets or sets the initial starting size for this table.
/// </summary>
/// <returns>
/// The initial starting size in rows of this table. The default is 50.
/// </returns>
int MinimumCapacity { get; set; }
/// <summary>
/// Gets or sets the namespace for the XML representation of the data stored in the <see cref="T:System.Data.DataTable"/>.
/// </summary>
/// <returns>
/// The namespace of the <see cref="T:System.Data.DataTable"/>.
/// </returns>
string Namespace { get; set; }
/// <summary>
/// Gets the collection of parent relations for this <see cref="T:System.Data.DataTable"/>.
/// </summary>
/// <returns>
/// A <see cref="T:System.Data.DataRelationCollection"/> that contains the parent relations for the table. An empty collection is returned
/// if no <see cref="T:System.Data.DataRelation"/> objects exist.
/// </returns>
DataRelationCollection ParentRelations { get; }
/// <summary>
/// Gets or sets the namespace for the XML representation of the data stored in the <see cref="T:System.Data.DataTable"/>.
/// </summary>
/// <returns>
/// The prefix of the <see cref="T:System.Data.DataTable"/>.
/// </returns>
string Prefix { get; set; }
/// <summary>
/// Gets or sets an array of columns that function as primary keys for the data table.
/// </summary>
/// <returns>
/// An array of <see cref="T:System.Data.DataColumn"/> objects.
/// </returns>
/// <exception cref="T:System.Data.DataException">
/// The key is a foreign key.
/// </exception>
DataColumn[] PrimaryKey { get; set; }
/// <summary>
/// Gets or sets the serialization format.
/// </summary>
/// <returns>
/// A <see cref="T:System.Data.SerializationFormat"/> enumeration specifying either Binary or Xml serialization.
/// </returns>
SerializationFormat RemotingFormat { get; set; }
/// <summary>
/// Gets the collection of rows that belong to this table.
/// </summary>
/// <returns>
/// A <see cref="T:System.Data.DataRowCollection"/> that contains <see cref="T:System.Data.DataRow"/> objects; otherwise a null value if
/// no <see cref="T:System.Data.DataRow"/> objects exist.
/// </returns>
DataRowCollection Rows { get; }
/// <summary>
/// Gets or sets an <see cref="T:System.ComponentModel.ISite"/> for the <see cref="T:System.Data.DataTable"/>.
/// </summary>
/// <returns>
/// An <see cref="T:System.ComponentModel.ISite"/> for the <see cref="T:System.Data.DataTable"/>.
/// </returns>
ISite Site { get; set; }
/// <summary>
/// Gets or sets the name of the <see cref="T:System.Data.DataTable"/>.
/// </summary>
/// <returns>
/// The name of the <see cref="T:System.Data.DataTable"/>.
/// </returns>
/// <exception cref="T:System.ArgumentException">
/// null or empty string ("") is passed in and this table belongs to a collection.
/// </exception>
/// <exception cref="T:System.Data.DuplicateNameException">
/// The table belongs to a collection that already has a table with the same name. (Comparison is case-sensitive).
/// </exception>
string TableName { get; set; }
#endregion
#region Public Methods and Operators
/// <summary>
/// Commits all the changes made to this table since the last time <see cref="M:System.Data.DataTable.AcceptChanges"/> was called.
/// </summary>
void AcceptChanges();
/// <summary>
/// Begins the initialization of a <see cref="T:System.Data.DataTable"/> that is used on a form or used by another component.
/// The initialization occurs at run time.
/// </summary>
void BeginInit();
/// <summary>
/// Turns off notifications, index maintenance, and constraints while loading data.
/// </summary>
void BeginLoadData();
/// <summary>
/// Clears the <see cref="T:System.Data.DataTable"/> of all data.
/// </summary>
void Clear();
/// <summary>
/// Clones the structure of the <see cref="T:System.Data.DataTable"/>, including all <see cref="T:System.Data.DataTable"/> schemas and constraints.
/// </summary>
/// <returns>
/// A new <see cref="T:System.Data.DataTable"/> with the same schema as the current <see cref="T:System.Data.DataTable"/>.
/// </returns>
IDataTable Clone();
/// <summary>
/// Computes the given expression on the current rows that pass the filter criteria.
/// </summary>
/// <returns>
/// An <see cref="T:System.Object"/>, set to the result of the computation. If the expression evaluates to null, the return value will be <see cref="F:System.DBNull.Value"/>.
/// </returns>
/// <param name="expression">
/// The expression to compute.
/// </param>
/// <param name="filter">
/// The filter to limit the rows that evaluate in the expression.
/// </param>
object Compute(string expression,
string filter);
/// <summary>
/// Copies both the structure and data for this <see cref="T:System.Data.DataTable"/>.
/// </summary>
/// <returns>
/// A new <see cref="T:System.Data.DataTable"/> with the same structure (table schemas and constraints) and data as this
/// <see cref="T:System.Data.DataTable"/>.If these classes have been derived, the copy will also be of the same derived classes.
/// <see cref="M:System.Data.DataTable.Copy"/> creates a new <see cref="T:System.Data.DataTable"/> with the same structure and data as
/// the original <see cref="T:System.Data.DataTable"/>. To copy the structure to a new <see cref="T:System.Data.DataTable"/>, but not the
/// data, use <see cref="M:System.Data.DataTable.Clone"/>.
/// </returns>
IDataTable Copy();
/// <summary>
/// Returns a <see cref="T:System.Data.DataTableReader"/> corresponding to the data within this <see cref="T:System.Data.DataTable"/>.
/// </summary>
/// <returns>
/// A <see cref="T:System.Data.DataTableReader"/> containing one result set, corresponding to the source <see cref="T:System.Data.DataTable"/>
/// instance.
/// </returns>
DataTableReader CreateDataReader();
/// <summary>
/// Ends the initialization of a <see cref="T:System.Data.DataTable"/> that is used on a form or used by another component. The initialization
/// occurs at run time.
/// </summary>
void EndInit();
/// <summary>
/// Turns on notifications, index maintenance, and constraints after loading data.
/// </summary>
void EndLoadData();
/// <summary>
/// Gets a copy of the <see cref="T:System.Data.DataTable"/> that contains all changes made to it since it was loaded or
/// <see cref="M:System.Data.DataTable.AcceptChanges"/> was last called.
/// </summary>
/// <returns>
/// A copy of the changes from this <see cref="T:System.Data.DataTable"/>, or null if no changes are found.
/// </returns>
IDataTable GetChanges();
/// <summary>
/// Gets a copy of the <see cref="T:System.Data.DataTable"/> containing all changes made to it since it was last loaded, or since
/// <see cref="M:System.Data.DataTable.AcceptChanges"/> was called, filtered by <see cref="T:System.Data.DataRowState"/>.
/// </summary>
/// <returns>
/// A filtered copy of the <see cref="T:System.Data.DataTable"/> that can have actions performed on it, and later be merged back in the
/// <see cref="T:System.Data.DataTable"/> using <see cref="M:System.Data.DataSet.Merge(System.Data.DataSet)"/>. If no rows of the desired
/// <see cref="T:System.Data.DataRowState"/> are found, the method returns null.
/// </returns>
/// <param name="rowStates">
/// One of the <see cref="T:System.Data.DataRowState"/> values.
/// </param>
IDataTable GetChanges(DataRowState rowStates);
/// <summary>
/// Gets an array of <see cref="T:System.Data.DataRow"/> objects that contain errors.
/// </summary>
/// <returns>
/// An array of <see cref="T:System.Data.DataRow"/> objects that have errors.
/// </returns>
DataRow[] GetErrors();
/// <summary>
/// Populates a serialization information object with the data needed to serialize the <see cref="T:System.Data.DataTable"/>.
/// </summary>
/// <param name="info">
/// A <see cref="T:System.Runtime.Serialization.SerializationInfo"/> object that holds the serialized data associated with the
/// <see cref="T:System.Data.DataTable"/>.
/// </param>
/// <param name="context">
/// A <see cref="T:System.Runtime.Serialization.StreamingContext"/> object that contains the source and destination of the serialized
/// stream associated with the <see cref="T:System.Data.DataTable"/>.
/// </param>
/// <exception cref="T:System.ArgumentNullException">
/// The <paramref name="info"/> parameter is a null reference (Nothing in Visual Basic).
/// </exception>
void GetObjectData(SerializationInfo info,
StreamingContext context);
/// <summary>
/// Copies a <see cref="T:System.Data.DataRow"/> into a <see cref="T:System.Data.DataTable"/>, preserving any property settings, as well as original and current values.
/// </summary>
/// <param name="row">
/// The <see cref="T:System.Data.DataRow"/> to be imported.
/// </param>
void ImportRow(DataRow row);
/// <summary>
/// Fills a <see cref="T:System.Data.DataTable"/> with values from a data source using the supplied <see cref="T:System.Data.IDataReader"/>.
/// If the <see cref="T:System.Data.DataTable"/> already contains rows, the incoming data from the data source is merged with the existing rows.
/// </summary>
/// <param name="reader">
/// An <see cref="T:System.Data.IDataReader"/> that provides a result set.
/// </param>
void Load(IDataReader reader);
/// <summary>
/// Fills a <see cref="T:System.Data.DataTable"/> with values from a data source using the supplied <see cref="T:System.Data.IDataReader"/>.
/// If the DataTable already contains rows, the incoming data from the data source is merged with the existing rows according to the value of
/// the <paramref name="loadOption"/> parameter.
/// </summary>
/// <param name="reader">
/// An <see cref="T:System.Data.IDataReader"/> that provides one or more result sets.
/// </param>
/// <param name="loadOption">
/// A value from the <see cref="T:System.Data.LoadOption"/> enumeration that indicates how rows already in the
/// <see cref="T:System.Data.DataTable"/> are combined with incoming rows that share the same primary key.
/// </param>
void Load(IDataReader reader,
LoadOption loadOption);
/// <summary>
/// Fills a <see cref="T:System.Data.DataTable"/> with values from a data source using the supplied <see cref="T:System.Data.IDataReader"/>
/// using an error-handling delegate.
/// </summary>
/// <param name="reader">
/// A <see cref="T:System.Data.IDataReader"/> that provides a result set.
/// </param>
/// <param name="loadOption">
/// A value from the <see cref="T:System.Data.LoadOption"/> enumeration that indicates how rows already in the
/// <see cref="T:System.Data.DataTable"/> are combined with incoming rows that share the same primary key.
/// </param>
/// <param name="errorHandler">
/// A <see cref="T:System.Data.FillErrorEventHandler"/> delegate to call when an error occurs while loading data.
/// </param>
void Load(IDataReader reader,
LoadOption loadOption,
FillErrorEventHandler errorHandler);
/// <summary>
/// Finds and updates a specific row. If no matching row is found, a new row is created using the given values.
/// </summary>
/// <returns>
/// The new <see cref="T:System.Data.DataRow"/>.
/// </returns>
/// <param name="values">
/// An array of values used to create the new row.
/// </param>
/// <param name="acceptChanges">
/// true to accept changes; otherwise false.
/// </param>
/// <exception cref="T:System.ArgumentException">
/// The array is larger than the number of columns in the table.
/// </exception>
/// <exception cref="T:System.InvalidCastException">
/// A value doesn't match its respective column type.
/// </exception>
/// <exception cref="T:System.Data.ConstraintException">
/// Adding the row invalidates a constraint.
/// </exception>
/// <exception cref="T:System.Data.NoNullAllowedException">
/// Attempting to put a null in a column where <see cref="P:System.Data.DataColumn.AllowDBNull"/> is false.
/// </exception>
DataRow LoadDataRow(object[] values,
bool acceptChanges);
/// <summary>
/// Finds and updates a specific row. If no matching row is found, a new row is created using the given values.
/// </summary>
/// <returns>
/// The new <see cref="T:System.Data.DataRow"/>.
/// </returns>
/// <param name="values">
/// An array of values used to create the new row.
/// </param>
/// <param name="loadOption">
/// Used to determine how the array values are applied to the corresponding values in an existing row.
/// </param>
DataRow LoadDataRow(object[] values,
LoadOption loadOption);
/// <summary>
/// Merge the specified <see cref="T:System.Data.DataTable"/> with the current <see cref="T:System.Data.DataTable"/>.
/// </summary>
/// <param name="table">
/// The <see cref="T:System.Data.DataTable"/> to be merged with the current <see cref="T:System.Data.DataTable"/>.
/// </param>
void Merge(DataTable table);
/// <summary>
/// Merge the specified <see cref="T:System.Data.DataTable"/> with the current DataTable, indicating whether to preserve changes in
/// the current DataTable.
/// </summary>
/// <param name="table">
/// The DataTable to be merged with the current DataTable.
/// </param>
/// <param name="preserveChanges">
/// true, to preserve changes in the current DataTable; otherwise false.
/// </param>
void Merge(DataTable table,
bool preserveChanges);
/// <summary>
/// Merge the specified <see cref="T:System.Data.DataTable"/> with the current DataTable, indicating whether to preserve changes and
/// how to handle missing schema in the current DataTable.
/// </summary>
/// <param name="table">
/// The <see cref="T:System.Data.DataTable"/> to be merged with the current <see cref="T:System.Data.DataTable"/>.
/// </param>
/// <param name="preserveChanges">
/// true, to preserve changes in the current <see cref="T:System.Data.DataTable"/>; otherwise false.
/// </param>
/// <param name="missingSchemaAction">
/// One of the <see cref="T:System.Data.MissingSchemaAction"/> values.
/// </param>
void Merge(DataTable table,
bool preserveChanges,
MissingSchemaAction missingSchemaAction);
/// <summary>
/// Creates a new <see cref="T:System.Data.DataRow"/> with the same schema as the table.
/// </summary>
/// <returns>
/// A <see cref="T:System.Data.DataRow"/> with the same schema as the <see cref="T:System.Data.DataTable"/>.
/// </returns>
DataRow NewRow();
/// <summary>
/// Reads XML schema and data into the <see cref="T:System.Data.DataTable"/> using the specified <see cref="T:System.IO.Stream"/>.
/// </summary>
/// <returns>
/// The <see cref="T:System.Data.XmlReadMode"/> used to read the data.
/// </returns>
/// <param name="stream">
/// An object that derives from <see cref="T:System.IO.Stream"/>
/// </param>
XmlReadMode ReadXml(Stream stream);
/// <summary>
/// Reads XML schema and data into the <see cref="T:System.Data.DataTable"/> using the specified <see cref="T:System.IO.TextReader"/>.
/// </summary>
/// <returns>
/// The <see cref="T:System.Data.XmlReadMode"/> used to read the data.
/// </returns>
/// <param name="reader">
/// The <see cref="T:System.IO.TextReader"/> that will be used to read the data.
/// </param>
XmlReadMode ReadXml(TextReader reader);
/// <summary>
/// Reads XML schema and data into the <see cref="T:System.Data.DataTable"/> from the specified file.
/// </summary>
/// <returns>
/// The <see cref="T:System.Data.XmlReadMode"/> used to read the data.
/// </returns>
/// <param name="fileName">
/// The name of the file from which to read the data.
/// </param>
XmlReadMode ReadXml(string fileName);
/// <summary>
/// Reads XML Schema and Data into the <see cref="T:System.Data.DataTable"/> using the specified <see cref="T:System.Xml.XmlReader"/>.
/// </summary>
/// <returns>
/// The <see cref="T:System.Data.XmlReadMode"/> used to read the data.
/// </returns>
/// <param name="reader">
/// The <see cref="T:System.Xml.XmlReader"/> that will be used to read the data.
/// </param>
XmlReadMode ReadXml(XmlReader reader);
/// <summary>
/// Reads an XML schema into the <see cref="T:System.Data.DataTable"/> using the specified stream.
/// </summary>
/// <param name="stream">
/// The stream used to read the schema.
/// </param>
void ReadXmlSchema(Stream stream);
/// <summary>
/// Reads an XML schema into the <see cref="T:System.Data.DataTable"/> using the specified <see cref="T:System.IO.TextReader"/>.
/// </summary>
/// <param name="reader">
/// The <see cref="T:System.IO.TextReader"/> used to read the schema information.
/// </param>
void ReadXmlSchema(TextReader reader);
/// <summary>
/// Reads an XML schema into the <see cref="T:System.Data.DataTable"/> from the specified file.
/// </summary>
/// <param name="fileName">
/// The name of the file from which to read the schema information.
/// </param>
void ReadXmlSchema(string fileName);
/// <summary>
/// Reads an XML schema into the <see cref="T:System.Data.DataTable"/> using the specified <see cref="T:System.Xml.XmlReader"/>.
/// </summary>
/// <param name="reader">
/// The <see cref="T:System.Xml.XmlReader"/> used to read the schema information.
/// </param>
void ReadXmlSchema(XmlReader reader);
/// <summary>
/// Rolls back all changes that have been made to the table since it was loaded, or the last time
/// <see cref="M:System.Data.DataTable.AcceptChanges"/> was called.
/// </summary>
void RejectChanges();
/// <summary>
/// Resets the <see cref="T:System.Data.DataTable"/> to its original state. Reset removes all data, indexes, relations, and columns of the table.
/// If a DataSet includes a DataTable, the table will still be part of the DataSet after the table is reset.
/// </summary>
void Reset();
/// <summary>
/// Gets an array of all <see cref="T:System.Data.DataRow"/> objects.
/// </summary>
/// <returns>
/// An array of <see cref="T:System.Data.DataRow"/> objects.
/// </returns>
DataRow[] Select();
/// <summary>
/// Gets an array of all <see cref="T:System.Data.DataRow"/> objects that match the filter criteria.
/// </summary>
/// <returns>
/// An array of <see cref="T:System.Data.DataRow"/> objects.
/// </returns>
/// <param name="filterExpression">
/// The criteria to use to filter the rows. For examples on how to filter rows, see DataView RowFilter Syntax [C#].
/// </param>
DataRow[] Select(string filterExpression);
/// <summary>
/// Gets an array of all <see cref="T:System.Data.DataRow"/> objects that match the filter criteria, in the specified sort order.
/// </summary>
/// <returns>
/// An array of <see cref="T:System.Data.DataRow"/> objects matching the filter expression.
/// </returns>
/// <param name="filterExpression">
/// The criteria to use to filter the rows. For examples on how to filter rows, see DataView RowFilter Syntax [C#].
/// </param>
/// <param name="sort">
/// A string specifying the column and sort direction.
/// </param>
DataRow[] Select(string filterExpression,
string sort);
/// <summary>
/// Gets an array of all <see cref="T:System.Data.DataRow"/> objects that match the filter in the order of the sort that match the specified state.
/// </summary>
/// <returns>
/// An array of <see cref="T:System.Data.DataRow"/> objects.
/// </returns>
/// <param name="filterExpression">
/// The criteria to use to filter the rows. For examples on how to filter rows, see DataView RowFilter Syntax [C#].
/// </param>
/// <param name="sort">
/// A string specifying the column and sort direction.
/// </param>
/// <param name="recordStates">
/// One of the <see cref="T:System.Data.DataViewRowState"/> values.
/// </param>
DataRow[] Select(string filterExpression,
string sort,
DataViewRowState recordStates);
/// <summary>
/// Gets the <see cref="P:System.Data.DataTable.TableName"/> and <see cref="P:System.Data.DataTable.DisplayExpression"/>, if there is one as a
/// concatenated string.
/// </summary>
/// <returns>
/// A string consisting of the <see cref="P:System.Data.DataTable.TableName"/> and the <see cref="P:System.Data.DataTable.DisplayExpression"/> values.
/// </returns>
string ToString();
/// <summary>
/// Writes the current contents of the <see cref="T:System.Data.DataTable"/> as XML using the specified <see cref="T:System.IO.Stream"/>.
/// </summary>
/// <param name="stream">
/// The stream to which the data will be written.
/// </param>
void WriteXml(Stream stream);
/// <summary>
/// Writes the current contents of the <see cref="T:System.Data.DataTable"/> as XML using the specified <see cref="T:System.IO.Stream"/>.
/// To save the data for the table and all its descendants, set the <paramref name="writeHierarchy"/> parameter to true.
/// </summary>
/// <param name="stream">
/// The stream to which the data will be written.
/// </param>
/// <param name="writeHierarchy">
/// If true, write the contents of the current table and all its descendants. If false (the default value), write the data for the current table only.
/// </param>
void WriteXml(Stream stream,
bool writeHierarchy);
/// <summary>
/// Writes the current contents of the <see cref="T:System.Data.DataTable"/> as XML using the specified <see cref="T:System.IO.TextWriter"/>.
/// </summary>
/// <param name="writer">
/// The <see cref="T:System.IO.TextWriter"/> with which to write the content.
/// </param>
void WriteXml(TextWriter writer);
/// <summary>
/// Writes the current contents of the <see cref="T:System.Data.DataTable"/> as XML using the specified <see cref="T:System.IO.TextWriter"/>.
/// To save the data for the table and all its descendants, set the <paramref name="writeHierarchy"/> parameter to true.
/// </summary>
/// <param name="writer">
/// The <see cref="T:System.IO.TextWriter"/> with which to write the content.
/// </param>
/// <param name="writeHierarchy">
/// If true, write the contents of the current table and all its descendants. If false (the default value), write the data for the current table only.
/// </param>
void WriteXml(TextWriter writer,
bool writeHierarchy);
/// <summary>
/// Writes the current contents of the <see cref="T:System.Data.DataTable"/> as XML using the specified <see cref="T:System.Xml.XmlWriter"/>.
/// </summary>
/// <param name="writer">
/// The <see cref="T:System.Xml.XmlWriter"/> with which to write the contents.
/// </param>
void WriteXml(XmlWriter writer);
/// <summary>
/// Writes the current contents of the <see cref="T:System.Data.DataTable"/> as XML using the specified <see cref="T:System.Xml.XmlWriter"/>.
/// </summary>
/// <param name="writer">
/// The <see cref="T:System.Xml.XmlWriter"/> with which to write the contents.
/// </param>
/// <param name="writeHierarchy">
/// If true, write the contents of the current table and all its descendants. If false (the default value), write the data for the current table only.
/// </param>
void WriteXml(XmlWriter writer,
bool writeHierarchy);
/// <summary>
/// Writes the current contents of the <see cref="T:System.Data.DataTable"/> as XML using the specified file.
/// </summary>
/// <param name="fileName">
/// The file to which to write the XML data.
/// </param>
void WriteXml(string fileName);
/// <summary>
/// Writes the current contents of the <see cref="T:System.Data.DataTable"/> as XML using the specified file. To save the data for the table and all its descendants, set the <paramref name="writeHierarchy"/> parameter to true.
/// </summary>
/// <param name="fileName">
/// The file to which to write the XML data.
/// </param>
/// <param name="writeHierarchy">
/// If true, write the contents of the current table and all its descendants. If false (the default value), write the data for the current table only.
/// </param>
void WriteXml(string fileName,
bool writeHierarchy);
/// <summary>
/// Writes the current data, and optionally the schema, for the <see cref="T:System.Data.DataTable"/> to the specified file using the specified <see cref="T:System.Data.XmlWriteMode"/>. To write the schema, set the value for the <paramref name="mode"/> parameter to WriteSchema.
/// </summary>
/// <param name="stream">
/// The stream to which the data will be written.
/// </param>
/// <param name="mode">
/// One of the <see cref="T:System.Data.XmlWriteMode"/> values.
/// </param>
void WriteXml(Stream stream,
XmlWriteMode mode);
/// <summary>
/// Writes the current data, and optionally the schema, for the <see cref="T:System.Data.DataTable"/> to the specified file using the specified <see cref="T:System.Data.XmlWriteMode"/>. To write the schema, set the value for the <paramref name="mode"/> parameter to WriteSchema. To save the data for the table and all its descendants, set the <paramref name="writeHierarchy"/> parameter to true.
/// </summary>
/// <param name="stream">
/// The stream to which the data will be written.
/// </param>
/// <param name="mode">
/// One of the <see cref="T:System.Data.XmlWriteMode"/> values.
/// </param>
/// <param name="writeHierarchy">
/// If true, write the contents of the current table and all its descendants. If false (the default value), write the data for the current table only.
/// </param>
void WriteXml(Stream stream,
XmlWriteMode mode,
bool writeHierarchy);
/// <summary>
/// Writes the current data, and optionally the schema, for the <see cref="T:System.Data.DataTable"/> using the specified
/// <see cref="T:System.IO.TextWriter"/> and <see cref="T:System.Data.XmlWriteMode"/>. To write the schema, set the value for the
/// <paramref name="mode"/> parameter to WriteSchema.
/// </summary>
/// <param name="writer">
/// The <see cref="T:System.IO.TextWriter"/> used to write the document.
/// </param>
/// <param name="mode">
/// One of the <see cref="T:System.Data.XmlWriteMode"/> values.
/// </param>
void WriteXml(TextWriter writer,
XmlWriteMode mode);
/// <summary>
/// Writes the current data, and optionally the schema, for the <see cref="T:System.Data.DataTable"/> using the specified
/// <see cref="T:System.IO.TextWriter"/> and <see cref="T:System.Data.XmlWriteMode"/>. To write the schema, set the value for the
/// <paramref name="mode"/> parameter to WriteSchema. To save the data for the table and all its descendants, set the
/// <paramref name="writeHierarchy"/> parameter to true.
/// </summary>
/// <param name="writer">
/// The <see cref="T:System.IO.TextWriter"/> used to write the document.
/// </param>
/// <param name="mode">
/// One of the <see cref="T:System.Data.XmlWriteMode"/> values.
/// </param>
/// <param name="writeHierarchy">
/// If true, write the contents of the current table and all its descendants. If false (the default value), write the data for the current table only.
/// </param>
void WriteXml(TextWriter writer,
XmlWriteMode mode,
bool writeHierarchy);
/// <summary>
/// Writes the current data, and optionally the schema, for the <see cref="T:System.Data.DataTable"/> using the specified
/// <see cref="T:System.Xml.XmlWriter"/> and <see cref="T:System.Data.XmlWriteMode"/>. To write the schema, set the value for the
/// <paramref name="mode"/> parameter to WriteSchema.
/// </summary>
/// <param name="writer">
/// The <see cref="T:System.Xml.XmlWriter"/> used to write the document.
/// </param>
/// <param name="mode">
/// One of the <see cref="T:System.Data.XmlWriteMode"/> values.
/// </param>
void WriteXml(XmlWriter writer,
XmlWriteMode mode);
/// <summary>
/// Writes the current data, and optionally the schema, for the <see cref="T:System.Data.DataTable"/> using the specified
/// <see cref="T:System.Xml.XmlWriter"/> and <see cref="T:System.Data.XmlWriteMode"/>. To write the schema, set the value for the
/// <paramref name="mode"/> parameter to WriteSchema. To save the data for the table and all its descendants, set the
/// <paramref name="writeHierarchy"/> parameter to true.
/// </summary>
/// <param name="writer">
/// The <see cref="T:System.Xml.XmlWriter"/> used to write the document.
/// </param>
/// <param name="mode">
/// One of the <see cref="T:System.Data.XmlWriteMode"/> values.
/// </param>
/// <param name="writeHierarchy">
/// If true, write the contents of the current table and all its descendants. If false (the default value), write the data for the current table only.
/// </param>
void WriteXml(XmlWriter writer,
XmlWriteMode mode,
bool writeHierarchy);
/// <summary>
/// Writes the current data, and optionally the schema, for the <see cref="T:System.Data.DataTable"/> using the specified file and
/// <see cref="T:System.Data.XmlWriteMode"/>. To write the schema, set the value for the <paramref name="mode"/> parameter to WriteSchema.
/// </summary>
/// <param name="fileName">
/// The name of the file to which the data will be written.
/// </param>
/// <param name="mode">
/// One of the <see cref="T:System.Data.XmlWriteMode"/> values.
/// </param>
void WriteXml(string fileName,
XmlWriteMode mode);
/// <summary>
/// Writes the current data, and optionally the schema, for the <see cref="T:System.Data.DataTable"/> using the specified file and
/// <see cref="T:System.Data.XmlWriteMode"/>. To write the schema, set the value for the <paramref name="mode"/> parameter to WriteSchema.
/// To save the data for the table and all its descendants, set the <paramref name="writeHierarchy"/> parameter to true.
/// </summary>
/// <param name="fileName">
/// The name of the file to which the data will be written.
/// </param>
/// <param name="mode">
/// One of the <see cref="T:System.Data.XmlWriteMode"/> values.
/// </param>
/// <param name="writeHierarchy">
/// If true, write the contents of the current table and all its descendants. If false (the default value), write the data for the current table only.
/// </param>
void WriteXml(string fileName,
XmlWriteMode mode,
bool writeHierarchy);
/// <summary>
/// Writes the current data structure of the <see cref="T:System.Data.DataTable"/> as an XML schema to the specified stream.
/// </summary>
/// <param name="stream">
/// The stream to which the XML schema will be written.
/// </param>
void WriteXmlSchema(Stream stream);
/// <summary>
/// Writes the current data structure of the <see cref="T:System.Data.DataTable"/> as an XML schema to the specified stream. To save the schema
/// for the table and all its descendants, set the <paramref name="writeHierarchy"/> parameter to true.
/// </summary>
/// <param name="stream">
/// The stream to which the XML schema will be written.
/// </param>
/// <param name="writeHierarchy">
/// If true, write the schema of the current table and all its descendants. If false (the default value), write the schema for the current table only.
/// </param>
void WriteXmlSchema(Stream stream,
bool writeHierarchy);
/// <summary>
/// Writes the current data structure of the <see cref="T:System.Data.DataTable"/> as an XML schema using the specified
/// <see cref="T:System.IO.TextWriter"/>.
/// </summary>
/// <param name="writer">
/// The <see cref="T:System.IO.TextWriter"/> with which to write.
/// </param>
void WriteXmlSchema(TextWriter writer);
/// <summary>
/// Writes the current data structure of the <see cref="T:System.Data.DataTable"/> as an XML schema using the specified
/// <see cref="T:System.IO.TextWriter"/>. To save the schema for the table and all its descendants, set the <paramref name="writeHierarchy"/>
/// parameter to true.
/// </summary>
/// <param name="writer">
/// The <see cref="T:System.IO.TextWriter"/> with which to write.
/// </param>
/// <param name="writeHierarchy">
/// If true, write the schema of the current table and all its descendants. If false (the default value), write the schema for the current table only.
/// </param>
void WriteXmlSchema(TextWriter writer,
bool writeHierarchy);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,59 @@
namespace SystemInterface.Data.DataTable
{
using System.Data;
/// <summary>
/// Factory to create a new <see cref="IDataTable"/> instance.
/// </summary>
public interface IDataTableFactory
{
#region Public Methods and Operators
/// <summary>
/// Creates a new <see cref="IDataTable"/> instance using the default constructor.
/// </summary>
/// <returns>
/// The <see cref="IDataTable"/>.
/// </returns>
IDataTable Create();
/// <summary>
/// Creates a new <see cref="IDataTable"/> instance passing the table name.
/// </summary>
/// <param name="tableName">
/// The table name.
/// </param>
/// <returns>
/// The <see cref="IDataTable"/>.
/// </returns>
IDataTable Create(string tableName);
/// <summary>
/// Creates a new <see cref="IDataTable"/> instance passing the table name and namespace.
/// </summary>
/// <param name="tableName">
/// The table name.
/// </param>
/// <param name="tableNamespace">
/// The table namespace.
/// </param>
/// <returns>
/// The <see cref="IDataTable"/>.
/// </returns>
IDataTable Create(string tableName,
string tableNamespace);
/// <summary>
/// Creates a new <see cref="IDataTable"/> instance passing a data table.
/// </summary>
/// <param name="dataTable">
/// The data table.
/// </param>
/// <returns>
/// The <see cref="IDataTable"/>.
/// </returns>
IDataTable Create(DataTable dataTable);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,59 @@
namespace SystemInterface.Data.SqlClient
{
using System.Data.SqlClient;
/// <summary>
/// Factory to create a new <see cref="ISqlCommand"/> instance.
/// </summary>
public interface ISqlCommandFactory
{
#region Public Methods and Operators
/// <summary>
/// Creates a new <see cref="ISqlCommand"/> instance using the default constructor.
/// </summary>
/// <returns>
/// The <see cref="ISqlCommand"/>.
/// </returns>
ISqlCommand Create();
/// <summary>
/// Creates a new <see cref="ISqlCommand"/> instance passing the command.
/// </summary>
/// <param name="command">
/// The command.
/// </param>
/// <returns>
/// The <see cref="ISqlCommand"/>.
/// </returns>
ISqlCommand Create(SqlCommand command);
/// <summary>
/// Creates a new <see cref="ISqlCommand"/> instance passing the command text.
/// </summary>
/// <param name="cmdText">
/// The cmd text.
/// </param>
/// <returns>
/// The <see cref="ISqlCommand"/>.
/// </returns>
ISqlCommand Create(string cmdText);
/// <summary>
/// Creates a new <see cref="ISqlCommand"/> instance passing the command text and the connection.
/// </summary>
/// <param name="cmdText">
/// The cmd text.
/// </param>
/// <param name="connection">
/// The connection.
/// </param>
/// <returns>
/// The <see cref="ISqlCommand"/>.
/// </returns>
ISqlCommand Create(string cmdText,
ISqlConnection connection);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,44 @@
namespace SystemInterface.Data.SqlClient
{
using System.Data.SqlClient;
/// <summary>
/// Factory to create a new <see cref="ISqlConnection"/> instance.
/// </summary>
public interface ISqlConnectionFactory
{
#region Public Methods and Operators
/// <summary>
/// Creates a new <see cref="ISqlConnection"/> instance using the default constructor.
/// </summary>
/// <returns>
/// The <see cref="ISqlConnection"/>.
/// </returns>
ISqlConnection Create();
/// <summary>
/// Creates a new <see cref="ISqlConnection"/> instance passing the connection.
/// </summary>
/// <param name="connection">
/// The connection.
/// </param>
/// <returns>
/// The <see cref="ISqlConnection"/>.
/// </returns>
ISqlConnection Create(SqlConnection connection);
/// <summary>
/// Creates a new <see cref="ISqlConnection"/> instance passingn the connection string.
/// </summary>
/// <param name="connectionString">
/// The connection string.
/// </param>
/// <returns>
/// The <see cref="ISqlConnection"/>.
/// </returns>
ISqlConnection Create(string connectionString);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,532 @@
namespace SystemInterface.Data.SqlClient
{
using System;
using System.ComponentModel;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
using System.Runtime.Remoting;
/// <summary>
/// Wrapper for <see cref="T:System.Data.SqlClient.SqlCommand"/> class.
/// </summary>
public interface ISqlDataAdapter
{
#region Public Events
/// <summary>
/// Occurs when the component is disposed by a call to the <see cref="M:System.ComponentModel.Component.Dispose"/> method.
/// </summary>
event EventHandler Disposed;
/// <summary>
/// Returned when an error occurs during a fill operation.
/// </summary>
event FillErrorEventHandler FillError;
/// <summary>
/// Occurs during <see cref="M:System.Data.Common.DbDataAdapter.Update(System.Data.DataSet)"/> after a command is executed against the
/// data source. The attempt to update is made, so the event fires.
/// </summary>
event SqlRowUpdatedEventHandler RowUpdated;
/// <summary>
/// Occurs during <see cref="M:System.Data.Common.DbDataAdapter.Update(System.Data.DataSet)"/> before a command is executed against the
/// data source. The attempt to update is made, so the event fires.
/// </summary>
event SqlRowUpdatingEventHandler RowUpdating;
#endregion
#region Public Properties
/// <summary>
/// Gets or sets a value indicating whether <see cref="M:System.Data.DataRow.AcceptChanges"/> is called on a <see cref="T:System.Data.DataRow"/>
/// after it is added to the <see cref="T:System.Data.DataTable"/> during any of the Fill operations.
/// </summary>
/// <returns>
/// true if <see cref="M:System.Data.DataRow.AcceptChanges"/> is called on the <see cref="T:System.Data.DataRow"/>; otherwise false.
/// The default is true.
/// </returns>
bool AcceptChangesDuringFill { get; set; }
/// <summary>
/// Gets or sets whether <see cref="M:System.Data.DataRow.AcceptChanges"/> is called during a
/// <see cref="M:System.Data.Common.DataAdapter.Update(System.Data.DataSet)"/>.
/// </summary>
/// <returns>
/// true if <see cref="M:System.Data.DataRow.AcceptChanges"/> is called during an
/// <see cref="M:System.Data.Common.DataAdapter.Update(System.Data.DataSet)"/>; otherwise false. The default is true.
/// </returns>
bool AcceptChangesDuringUpdate { get; set; }
/// <summary>
/// Returns the component's container.
/// </summary>
IContainer Container { get; }
/// <summary>
/// Gets or sets a value that specifies whether to generate an exception when an error is encountered during a row update.
/// </summary>
/// <returns>
/// true to continue the update without generating an exception; otherwise false. The default is false.
/// </returns>
bool ContinueUpdateOnError { get; set; }
/// <summary>
/// Gets or sets a Transact-SQL statement or stored procedure to delete records from the data set.
/// </summary>
/// <returns>
/// A <see cref="T:System.Data.SqlClient.SqlCommand"/> used during <see cref="M:System.Data.Common.DbDataAdapter.Update(System.Data.DataSet)"/> to delete records in the database that correspond to deleted rows in the <see cref="T:System.Data.DataSet"/>.
/// </returns>
ISqlCommand DeleteCommand { get; set; }
/// <summary>
/// Gets or sets the <see cref="T:System.Data.LoadOption"/> that determines how the adapter fills the <see cref="T:System.Data.DataTable"/>
/// from the <see cref="T:System.Data.Common.DbDataReader"/>.
/// </summary>
/// <returns>
/// A <see cref="T:System.Data.LoadOption"/> value.
/// </returns>
LoadOption FillLoadOption { get; set; }
/// <summary>
/// Gets or sets a Transact-SQL statement or stored procedure to insert new records into the data source.
/// </summary>
/// <returns>
/// A <see cref="T:System.Data.SqlClient.SqlCommand"/> used during <see cref="M:System.Data.Common.DbDataAdapter.Update(System.Data.DataSet)"/> to insert records into the database that correspond to new rows in the <see cref="T:System.Data.DataSet"/>.
/// </returns>
ISqlCommand InsertCommand { get; set; }
/// <summary>
/// Determines the action to take when incoming data does not have a matching table or column.
/// </summary>
/// <returns>
/// One of the <see cref="T:System.Data.MissingMappingAction"/> values. The default is Passthrough.
/// </returns>
/// <exception cref="T:System.ArgumentException">
/// The value set is not one of the <see cref="T:System.Data.MissingMappingAction"/> values.
/// </exception>
MissingMappingAction MissingMappingAction { get; set; }
/// <summary>
/// Determines the action to take when existing <see cref="T:System.Data.DataSet"/> schema does not match incoming data.
/// </summary>
/// <returns>
/// One of the <see cref="T:System.Data.MissingSchemaAction"/> values. The default is Add.
/// </returns>
/// <exception cref="T:System.ArgumentException">
/// The value set is not one of the <see cref="T:System.Data.MissingSchemaAction"/> values.
/// </exception>
MissingSchemaAction MissingSchemaAction { get; set; }
/// <summary>
/// Gets or sets whether the Fill method should return provider-specific values or common CLS-compliant values.
/// </summary>
/// <returns>
/// true if the Fill method should return provider-specific values; otherwise false to return common CLS-compliant values.
/// </returns>
bool ReturnProviderSpecificTypes { get; set; }
/// <summary>
/// Gets or sets a Transact-SQL statement or stored procedure used to select records in the data source.
/// </summary>
/// <returns>
/// A <see cref="T:System.Data.SqlClient.SqlCommand"/> used during <see cref="M:System.Data.Common.DbDataAdapter.Fill(System.Data.DataSet)"/> to select records from the database for placement in the <see cref="T:System.Data.DataSet"/>.
/// </returns>
ISqlCommand SelectCommand { get; set; }
/// <summary>
/// Gets or sets the site of the <see cref='System.ComponentModel.Component'/>.
/// </summary>
ISite Site { get; set; }
/// <summary>
/// Gets a collection that provides the master mapping between a source table and a <see cref="T:System.Data.DataTable"/>.
/// </summary>
/// <returns>
/// A collection that provides the master mapping between the returned records and the <see cref="T:System.Data.DataSet"/>.
/// The default value is an empty collection.
/// </returns>
DataTableMappingCollection TableMappings { get; }
/// <summary>
/// Gets or sets the number of rows that are processed in each round-trip to the server.
/// </summary>
/// <returns>
/// The number of rows to process per-batch. Value isEffect0There is no limit on the batch size..1Disables batch updating.&gt;1Changes are sent using batches of <see cref="P:System.Data.SqlClient.SqlDataAdapter.UpdateBatchSize"/> operations at a time.When setting this to a value other than 1, all the commands associated with the <see cref="T:System.Data.SqlClient.SqlDataAdapter"/> have to have their UpdatedRowSource property set to None or OutputParameters. An exception is thrown otherwise.
/// </returns>
int UpdateBatchSize { get; set; }
/// <summary>
/// Gets or sets a Transact-SQL statement or stored procedure used to update records in the data source.
/// </summary>
/// <returns>
/// A <see cref="T:System.Data.SqlClient.SqlCommand"/> used during <see cref="M:System.Data.Common.DbDataAdapter.Update(System.Data.DataSet)"/> to update records in the database that correspond to modified rows in the <see cref="T:System.Data.DataSet"/>.
/// </returns>
ISqlCommand UpdateCommand { get; set; }
#endregion
// event SqlRowUpdatedEventHandler RowUpdated
// event SqlRowUpdatingEventHandler RowUpdating
#region Public Methods and Operators
/// <summary>
/// Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.
/// </summary>
/// <param name="requestedType">
/// The requested type.
/// </param>
/// <returns>
/// The <see cref="ObjRef"/>.
/// </returns>
ObjRef CreateObjRef(Type requestedType);
/// <summary>
/// Disposes of the <see cref='System.ComponentModel.Component'/>.
/// </summary>
void Dispose();
/// <summary>
/// Returns a boolean indicating if the passed in object obj is Equal to this. Equality is defined as object equality for reference
/// types and bitwise equality for value types using a loader trick to replace Equals with EqualsValue for value types).
/// </summary>
/// <param name="obj">
/// The obj.
/// </param>
/// <returns>
/// The <see cref="bool"/>.
/// </returns>
bool Equals(Object obj);
/// <summary>
/// Adds or refreshes rows in the <see cref="T:System.Data.DataSet"/>.
/// </summary>
/// <returns>
/// The number of rows successfully added to or refreshed in the <see cref="T:System.Data.DataSet"/>. This does not include rows
/// affected by statements that do not return rows.
/// </returns>
/// <param name="dataSet">
/// A <see cref="T:System.Data.DataSet"/> to fill with records and, if necessary, schema.
/// </param>
int Fill(DataSet dataSet);
/// <summary>
/// Adds or refreshes rows in the <see cref="T:System.Data.DataSet"/> to match those in the data source using the
/// <see cref="T:System.Data.DataSet"/> and <see cref="T:System.Data.DataTable"/> names.
/// </summary>
/// <returns>
/// The number of rows successfully added to or refreshed in the <see cref="T:System.Data.DataSet"/>. This does not include rows
/// affected by statements that do not return rows.
/// </returns>
/// <param name="dataSet">
/// A <see cref="T:System.Data.DataSet"/> to fill with records and, if necessary, schema.
/// </param>
/// <param name="srcTable">
/// The name of the source table to use for table mapping.
/// </param>
/// <exception cref="T:System.SystemException">
/// The source table is invalid.
/// </exception>
int Fill(DataSet dataSet,
string srcTable);
/// <summary>
/// Adds or refreshes rows in a specified range in the <see cref="T:System.Data.DataSet"/> to match those in the data source using the
/// <see cref="T:System.Data.DataSet"/> and <see cref="T:System.Data.DataTable"/> names.
/// </summary>
/// <returns>
/// The number of rows successfully added to or refreshed in the <see cref="T:System.Data.DataSet"/>. This does not include rows
/// affected by statements that do not return rows.
/// </returns>
/// <param name="dataSet">
/// A <see cref="T:System.Data.DataSet"/> to fill with records and, if necessary, schema.
/// </param>
/// <param name="startRecord">
/// The zero-based record number to start with.
/// </param>
/// <param name="maxRecords">
/// The maximum number of records to retrieve.
/// </param>
/// <param name="srcTable">
/// The name of the source table to use for table mapping.
/// </param>
/// <exception cref="T:System.SystemException">
/// The <see cref="T:System.Data.DataSet"/> is invalid.
/// </exception>
/// <exception cref="T:System.InvalidOperationException">
/// The source table is invalid.-or- The connection is invalid.
/// </exception>
/// <exception cref="T:System.InvalidCastException">
/// The connection could not be found.
/// </exception>
/// <exception cref="T:System.ArgumentException">
/// The <paramref name="startRecord"/> parameter is less than 0.-or- The <paramref name="maxRecords"/> parameter is less than 0.
/// </exception>
int Fill(DataSet dataSet,
int startRecord,
int maxRecords,
string srcTable);
/// <summary>
/// Adds or refreshes rows in a specified range in the <see cref="T:System.Data.DataSet"/> to match those in the data source using the
/// <see cref="T:System.Data.DataTable"/> name.
/// </summary>
/// <returns>
/// The number of rows successfully added to or refreshed in the <see cref="T:System.Data.DataSet"/>. This does not include rows affected
/// by statements that do not return rows.
/// </returns>
/// <param name="dataTable">
/// The name of the <see cref="T:System.Data.DataTable"/> to use for table mapping.
/// </param>
/// <exception cref="T:System.InvalidOperationException">
/// The source table is invalid.
/// </exception>
int Fill(DataTable dataTable);
/// <summary>
/// Adds or refreshes rows in a <see cref="T:System.Data.DataTable"/> to match those in the data source starting at the specified record
/// and retrieving up to the specified maximum number of records.
/// </summary>
/// <returns>
/// The number of rows successfully added to or refreshed in the <see cref="T:System.Data.DataTable"/>. This value does not include rows
/// affected by statements that do not return rows.
/// </returns>
/// <param name="startRecord">
/// The zero-based record number to start with.
/// </param>
/// <param name="maxRecords">
/// The maximum number of records to retrieve.
/// </param>
/// <param name="dataTables">
/// The <see cref="T:System.Data.DataTable"/> objects to fill from the data source.
/// </param>
int Fill(int startRecord,
int maxRecords,
params DataTable[] dataTables);
/// <summary>
/// Configures the schema of the specified <see cref="T:System.Data.DataTable"/> based on the specified <see cref="T:System.Data.SchemaType"/>.
/// </summary>
/// <returns>
/// A <see cref="T:System.Data.DataTable"/> that contains schema information returned from the data source.
/// </returns>
/// <param name="dataTable">
/// The <see cref="T:System.Data.DataTable"/> to be filled with the schema from the data source.
/// </param>
/// <param name="schemaType">
/// One of the <see cref="T:System.Data.SchemaType"/> values.
/// </param>
DataTable FillSchema(DataTable dataTable,
SchemaType schemaType);
/// <summary>
/// Adds a <see cref="T:System.Data.DataTable"/> named "Table" to the specified <see cref="T:System.Data.DataSet"/> and configures the schema
/// to match that in the data source based on the specified <see cref="T:System.Data.SchemaType"/>.
/// </summary>
/// <returns>
/// A reference to a collection of <see cref="T:System.Data.DataTable"/> objects that were added to the <see cref="T:System.Data.DataSet"/>.
/// </returns>
/// <param name="dataSet">
/// A <see cref="T:System.Data.DataSet"/> to insert the schema in.
/// </param>
/// <param name="schemaType">
/// One of the <see cref="T:System.Data.SchemaType"/> values that specify how to insert the schema.
/// </param>
DataTable[] FillSchema(DataSet dataSet,
SchemaType schemaType);
/// <summary>
/// Adds a <see cref="T:System.Data.DataTable"/> to the specified <see cref="T:System.Data.DataSet"/> and configures the schema to match
/// that in the data source based upon the specified <see cref="T:System.Data.SchemaType"/> and <see cref="T:System.Data.DataTable"/>.
/// </summary>
/// <returns>
/// A reference to a collection of <see cref="T:System.Data.DataTable"/> objects that were added to the <see cref="T:System.Data.DataSet"/>.
/// </returns>
/// <param name="dataSet">
/// A <see cref="T:System.Data.DataSet"/> to insert the schema in.
/// </param>
/// <param name="schemaType">
/// One of the <see cref="T:System.Data.SchemaType"/> values that specify how to insert the schema.
/// </param>
/// <param name="srcTable">
/// The name of the source table to use for table mapping.
/// </param>
/// <exception cref="T:System.ArgumentException">
/// A source table from which to get the schema could not be found.
/// </exception>
DataTable[] FillSchema(DataSet dataSet,
SchemaType schemaType,
string srcTable);
/// <summary>
/// Gets the parameters set by the user when executing an SQL SELECT statement.
/// </summary>
/// <returns>
/// An array of <see cref="T:System.Data.IDataParameter"/> objects that contains the parameters set by the user.
/// </returns>
IDataParameter[] GetFillParameters();
/// <summary>
/// GetHashCode is intended to serve as a hash function for this object. Based on the contents of the object, the hash function will
/// return a suitable value with a relatively random distribution over the various inputs.
/// </summary>
/// <returns>
/// The <see cref="int"/>.
/// </returns>
int GetHashCode();
/// <summary>
/// Retrieves the current lifetime service object that controls the lifetime policy for this instance.
/// </summary>
/// <returns>
/// The <see cref="Object"/>.
/// </returns>
Object GetLifetimeService();
/// <summary>
/// Returns a Type object which represent this object instance.
/// </summary>
/// <returns>
/// The <see cref="Type"/>.
/// </returns>
Type GetType();
/// <summary>
/// Obtains a lifetime service object to control the lifetime policy for this instance.
/// </summary>
/// <returns>
/// The <see cref="object"/>.
/// </returns>
object InitializeLifetimeService();
/// <summary>
/// Resets <see cref="P:System.Data.Common.DataAdapter.FillLoadOption"/> to its default state and causes
/// <see cref="M:System.Data.Common.DataAdapter.Fill(System.Data.DataSet)"/> to honor
/// <see cref="P:System.Data.Common.DataAdapter.AcceptChangesDuringFill"/>.
/// </summary>
void ResetFillLoadOption();
/// <summary>
/// Determines whether the <see cref="P:System.Data.Common.DataAdapter.AcceptChangesDuringFill"/> property should be persisted.
/// </summary>
/// <returns>
/// true if the <see cref="P:System.Data.Common.DataAdapter.AcceptChangesDuringFill"/> property is persisted; otherwise false.
/// </returns>
bool ShouldSerializeAcceptChangesDuringFill();
/// <summary>
/// Determines whether the <see cref="P:System.Data.Common.DataAdapter.FillLoadOption"/> property should be persisted.
/// </summary>
/// <returns>
/// true if the <see cref="P:System.Data.Common.DataAdapter.FillLoadOption"/> property is persisted; otherwise false.
/// </returns>
bool ShouldSerializeFillLoadOption();
/// <summary>
/// Returns a <see cref='System.String'/> containing the name of the <see cref='System.ComponentModel.Component'/> , if any.
/// This method should not be overridden. For internal use only.
/// </summary>
/// <returns>
/// The <see cref="String"/>.
/// </returns>
String ToString();
/// <summary>
/// Updates the values in the database by executing the respective INSERT, UPDATE, or DELETE statements for each inserted, updated, or
/// deleted row in the specified <see cref="T:System.Data.DataSet"/>.
/// </summary>
/// <returns>
/// The number of rows successfully updated from the <see cref="T:System.Data.DataSet"/>.
/// </returns>
/// <param name="dataSet">
/// The <see cref="T:System.Data.DataSet"/> used to update the data source.
/// </param>
/// <exception cref="T:System.InvalidOperationException">
/// The source table is invalid.
/// </exception>
/// <exception cref="T:System.Data.DBConcurrencyException">
/// An attempt to execute an INSERT, UPDATE, or DELETE statement resulted in zero records affected.
/// </exception>
int Update(DataSet dataSet);
/// <summary>
/// Updates the values in the database by executing the respective INSERT, UPDATE, or DELETE statements for each inserted, updated, or
/// deleted row in the specified array in the <see cref="T:System.Data.DataSet"/>.
/// </summary>
/// <returns>
/// The number of rows successfully updated from the <see cref="T:System.Data.DataSet"/>.
/// </returns>
/// <param name="dataRows">
/// An array of <see cref="T:System.Data.DataRow"/> objects used to update the data source.
/// </param>
/// <exception cref="T:System.ArgumentNullException">
/// The <see cref="T:System.Data.DataSet"/> is invalid.
/// </exception>
/// <exception cref="T:System.InvalidOperationException">
/// The source table is invalid.
/// </exception>
/// <exception cref="T:System.SystemException">
/// No <see cref="T:System.Data.DataRow"/> exists to update.-or- No <see cref="T:System.Data.DataTable"/> exists to update.-or-
/// No <see cref="T:System.Data.DataSet"/> exists to use as a source.
/// </exception>
/// <exception cref="T:System.Data.DBConcurrencyException">
/// An attempt to execute an INSERT, UPDATE, or DELETE statement resulted in zero records affected.
/// </exception>
int Update(DataRow[] dataRows);
/// <summary>
/// Updates the values in the database by executing the respective INSERT, UPDATE, or DELETE statements for each inserted, updated, or
/// deleted row in the specified <see cref="T:System.Data.DataTable"/>.
/// </summary>
/// <returns>
/// The number of rows successfully updated from the <see cref="T:System.Data.DataTable"/>.
/// </returns>
/// <param name="dataTable">
/// The <see cref="T:System.Data.DataTable"/> used to update the data source.
/// </param>
/// <exception cref="T:System.ArgumentNullException">
/// The <see cref="T:System.Data.DataSet"/> is invalid.
/// </exception>
/// <exception cref="T:System.InvalidOperationException">
/// The source table is invalid.
/// </exception>
/// <exception cref="T:System.SystemException">
/// No <see cref="T:System.Data.DataRow"/> exists to update.-or- No <see cref="T:System.Data.DataTable"/> exists to update.-or-
/// No <see cref="T:System.Data.DataSet"/> exists to use as a source.
/// </exception>
/// <exception cref="T:System.Data.DBConcurrencyException">
/// An attempt to execute an INSERT, UPDATE, or DELETE statement resulted in zero records affected.
/// </exception>
int Update(DataTable dataTable);
/// <summary>
/// Updates the values in the database by executing the respective INSERT, UPDATE, or DELETE statements for each inserted, updated, or
/// deleted row in the <see cref="T:System.Data.DataSet"/> with the specified <see cref="T:System.Data.DataTable"/> name.
/// </summary>
/// <returns>
/// The number of rows successfully updated from the <see cref="T:System.Data.DataSet"/>.
/// </returns>
/// <param name="dataSet">
/// The <see cref="T:System.Data.DataSet"/> to use to update the data source.
/// </param>
/// <param name="srcTable">
/// The name of the source table to use for table mapping.
/// </param>
/// <exception cref="T:System.ArgumentNullException">
/// The <see cref="T:System.Data.DataSet"/> is invalid.
/// </exception>
/// <exception cref="T:System.InvalidOperationException">
/// The source table is invalid.
/// </exception>
/// <exception cref="T:System.Data.DBConcurrencyException">
/// An attempt to execute an INSERT, UPDATE, or DELETE statement resulted in zero records affected.
/// </exception>
int Update(DataSet dataSet,
string srcTable);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,63 @@
namespace SystemInterface.Data.SqlClient
{
using System.Data.SqlClient;
/// <summary>
/// Factory to create a new <see cref="ISqlDataAdapter"/> instance.
/// </summary>
public interface ISqlDataAdapterFactory
{
#region Public Methods and Operators
/// <summary>
/// Creates a new <see cref="ISqlDataAdapter"/> instance using the default constructor.
/// </summary>
/// <returns>
/// The <see cref="ISqlDataAdapter"/>.
/// </returns>
ISqlDataAdapter Create();
/// <summary>
/// Creates a new <see cref="ISqlDataAdapter"/> instance passing the sql command.
/// </summary>
/// <param name="sqlCommand">
/// The sql command.
/// </param>
/// <returns>
/// The <see cref="ISqlDataAdapter"/>.
/// </returns>
ISqlDataAdapter Create(SqlCommand sqlCommand);
/// <summary>
/// Creates a new <see cref="ISqlDataAdapter"/> instance passing the select command text and the connection.
/// </summary>
/// <param name="selectCommandText">
/// The select command text.
/// </param>
/// <param name="selectConnection">
/// The select connection.
/// </param>
/// <returns>
/// The <see cref="ISqlDataAdapter"/>.
/// </returns>
ISqlDataAdapter Create(string selectCommandText,
SqlConnection selectConnection);
/// <summary>
/// Creates a new <see cref="ISqlDataAdapter"/> instance passing the select command text and the connection string.
/// </summary>
/// <param name="selectCommandText">
/// The select command text.
/// </param>
/// <param name="selectConnectionString">
/// The select connection string.
/// </param>
/// <returns>
/// The <see cref="ISqlDataAdapter"/>.
/// </returns>
ISqlDataAdapter Create(string selectCommandText,
string selectConnectionString);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,400 @@
namespace SystemInterface.Data.SqlClient
{
using System;
using System.Collections;
using System.Data;
using System.Data.SqlClient;
/// <summary>
/// Wrapper for <see cref="SqlParameterCollection"/> class.
/// </summary>
public interface ISqlParameterCollection
{
#region Public Properties
/// <summary>
/// Returns an Integer that contains the number of elements in the <see cref="T:System.Data.SqlClient.SqlParameterCollection"/>. Read-only.
/// </summary>
/// <returns>
/// The number of elements in the <see cref="T:System.Data.SqlClient.SqlParameterCollection"/> as an Integer.
/// </returns>
int Count { get; }
/// <summary>
/// Gets a value that indicates whether the <see cref="T:System.Data.SqlClient.SqlParameterCollection"/> has a fixed size.
/// </summary>
/// <returns>
/// Returns true if the <see cref="T:System.Data.SqlClient.SqlParameterCollection"/> has a fixed size; otherwise false.
/// </returns>
bool IsFixedSize { get; }
/// <summary>
/// Gets a value that indicates whether the <see cref="T:System.Data.SqlClient.SqlParameterCollection"/> is read-only.
/// </summary>
/// <returns>
/// Returns true if the <see cref="T:System.Data.SqlClient.SqlParameterCollection"/> is read only; otherwise false.
/// </returns>
bool IsReadOnly { get; }
/// <summary>
/// Gets a value that indicates whether the <see cref="T:System.Data.SqlClient.SqlParameterCollection"/> is synchronized.
/// </summary>
/// <returns>
/// Returns true if the <see cref="T:System.Data.SqlClient.SqlParameterCollection"/> is synchronized; otherwise false.
/// </returns>
bool IsSynchronized { get; }
/// <summary>
/// Gets an object that can be used to synchronize access to the <see cref="T:System.Data.SqlClient.SqlParameterCollection"/>.
/// </summary>
/// <returns>
/// An object that can be used to synchronize access to the <see cref="T:System.Data.SqlClient.SqlParameterCollection"/>.
/// </returns>
object SyncRoot { get; }
#endregion
#region Public Indexers
/// <summary>
/// Gets the <see cref="T:System.Data.SqlClient.SqlParameter"/> with the specified name.
/// </summary>
/// <returns>
/// The <see cref="T:System.Data.SqlClient.SqlParameter"/> with the specified name.
/// </returns>
/// <param name="parameterName">
/// The name of the parameter to retrieve.
/// </param>
/// <exception cref="T:System.IndexOutOfRangeException">
/// The specified <paramref name="parameterName"/> is not valid.
/// </exception>
SqlParameter this[string parameterName] { get; set; }
/// <summary>
/// Gets or sets the <see cref="T:System.Data.SqlClient.SqlParameter"/> with the specified index.
/// </summary>
/// <param name="index">
/// The index.
/// </param>
/// <returns>
/// The <see cref="SqlParameter"/>.
/// </returns>
SqlParameter this[int index] { get; set; }
#endregion
#region Public Methods and Operators
/// <summary>
/// Adds the specified <see cref="T:System.Data.SqlClient.SqlParameter"/> object to the <see cref="T:System.Data.SqlClient.SqlParameterCollection"/>.
/// </summary>
/// <returns>
/// A new <see cref="T:System.Data.SqlClient.SqlParameter"/> object.
/// </returns>
/// <param name="value">
/// The <see cref="T:System.Data.SqlClient.SqlParameter"/> to add to the collection.
/// </param>
/// <exception cref="T:System.ArgumentException">
/// The <see cref="T:System.Data.SqlClient.SqlParameter"/> specified in the <paramref name="value"/> parameter is already added to this or another
/// <see cref="T:System.Data.SqlClient.SqlParameterCollection"/>.
/// </exception>
/// <exception cref="T:System.InvalidCastException">
/// The parameter passed was not a <see cref="T:System.Data.SqlClient.SqlParameter"/>.
/// </exception>
/// <exception cref="T:System.ArgumentNullException">
/// The <paramref name="value"/> parameter is null.
/// </exception>
SqlParameter Add(SqlParameter value);
/// <summary>
/// Adds the specified <see cref="T:System.Data.SqlClient.SqlParameter"/> object to the <see cref="T:System.Data.SqlClient.SqlParameterCollection"/>.
/// </summary>
/// <returns>
/// The index of the new <see cref="T:System.Data.SqlClient.SqlParameter"/> object.
/// </returns>
/// <param name="value">
/// An <see cref="T:System.Object"/>.
/// </param>
int Add(object value);
/// <summary>
/// Adds the specified <see cref="T:System.Data.SqlClient.SqlParameter"/> object to the <see cref="T:System.Data.SqlClient.SqlParameterCollection"/>.
/// </summary>
/// <returns>
/// A new <see cref="T:System.Data.SqlClient.SqlParameter"/> object.Use caution when you are using this overload of the SqlParameterCollection.Add method to specify integer parameter values. Because this overload takes a <paramref name="value"/> of type <see cref="T:System.Object"/>, you must convert the integral value to an <see cref="T:System.Object"/> type when the value is zero, as the following C# example demonstrates. Copy Codeparameters.Add("@pname", Convert.ToInt32(0));If you do not perform this conversion, the compiler assumes that you are trying to call the SqlParameterCollection.Add (string, SqlDbType) overload.
/// </returns>
/// <param name="parameterName">
/// The name of the <see cref="T:System.Data.SqlClient.SqlParameter"/> to add to the collection.
/// </param>
/// <param name="value">
/// A <see cref="T:System.Object"/>.
/// </param>
/// <exception cref="T:System.ArgumentException">
/// The <see cref="T:System.Data.SqlClient.SqlParameter"/> specified in the <paramref name="value"/> parameter is already added to this or another
/// <see cref="T:System.Data.SqlClient.SqlParameterCollection"/>.
/// </exception>
/// <exception cref="T:System.ArgumentNullException">
/// The <paramref name="value"/> parameter is null.
/// </exception>
SqlParameter Add(string parameterName,
object value);
/// <summary>
/// Adds a <see cref="T:System.Data.SqlClient.SqlParameter"/> to the <see cref="T:System.Data.SqlClient.SqlParameterCollection"/> given the
/// parameter name and the data type.
/// </summary>
/// <returns>
/// A new <see cref="T:System.Data.SqlClient.SqlParameter"/> object.
/// </returns>
/// <param name="parameterName">
/// The name of the parameter. </param><param name="sqlDbType">One of the <see cref="T:System.Data.SqlDbType"/> values.
/// </param>
SqlParameter Add(string parameterName,
SqlDbType sqlDbType);
/// <summary>
/// Adds a <see cref="T:System.Data.SqlClient.SqlParameter"/> to the <see cref="T:System.Data.SqlClient.SqlParameterCollection"/>, given the
/// specified parameter name, <see cref="T:System.Data.SqlDbType"/> and size.
/// </summary>
/// <returns>
/// A new <see cref="T:System.Data.SqlClient.SqlParameter"/> object.
/// </returns>
/// <param name="parameterName">
/// The name of the parameter.
/// </param>
/// <param name="sqlDbType">
/// The <see cref="T:System.Data.SqlDbType"/> of the <see cref="T:System.Data.SqlClient.SqlParameter"/> to add to the collection.
/// </param>
/// <param name="size">
/// The size as an <see cref="T:System.Int32"/>.
/// </param>
SqlParameter Add(string parameterName,
SqlDbType sqlDbType,
int size);
/// <summary>
/// Adds a <see cref="T:System.Data.SqlClient.SqlParameter"/> to the <see cref="T:System.Data.SqlClient.SqlParameterCollection"/> with the
/// parameter name, the data type, and the column length.
/// </summary>
/// <returns>
/// A new <see cref="T:System.Data.SqlClient.SqlParameter"/> object.
/// </returns>
/// <param name="parameterName">
/// The name of the parameter. </param><param name="sqlDbType">One of the <see cref="T:System.Data.SqlDbType"/> values.
/// </param>
/// <param name="size">
/// The column length.</param><param name="sourceColumn">The name of the source column
/// (<see cref="P:System.Data.SqlClient.SqlParameter.SourceColumn"/>) if this <see cref="T:System.Data.SqlClient.SqlParameter"/> is used in a call
/// to <see cref="Overload:System.Data.Common.DbDataAdapter.Update"/>.
/// </param>
SqlParameter Add(string parameterName,
SqlDbType sqlDbType,
int size,
string sourceColumn);
/// <summary>
/// Adds an array of <see cref="T:System.Data.SqlClient.SqlParameter"/> values to the end of the
/// <see cref="T:System.Data.SqlClient.SqlParameterCollection"/>.
/// </summary>
/// <param name="values">
/// The <see cref="T:System.Data.SqlClient.SqlParameter"/> values to add.
/// </param>
void AddRange(SqlParameter[] values);
/// <summary>
/// Adds an array of values to the end of the <see cref="T:System.Data.SqlClient.SqlParameterCollection"/>.
/// </summary>
/// <param name="values">
/// The <see cref="T:System.Array"/> values to add.
/// </param>
void AddRange(Array values);
/// <summary>
/// Adds a value to the end of the <see cref="T:System.Data.SqlClient.SqlParameterCollection"/>.
/// </summary>
/// <returns>
/// A <see cref="T:System.Data.SqlClient.SqlParameter"/> object.
/// </returns>
/// <param name="parameterName">
/// The name of the parameter.</param><param name="value">The value to be added. Use <see cref="F:System.DBNull.Value"/> instead of null,
/// to indicate a null value.
/// </param>
SqlParameter AddWithValue(string parameterName,
object value);
/// <summary>
/// Removes all the <see cref="T:System.Data.SqlClient.SqlParameter"/> objects from the <see cref="T:System.Data.SqlClient.SqlParameterCollection"/>.
/// </summary>
void Clear();
/// <summary>
/// Determines whether the specified parameter name is in this <see cref="T:System.Data.SqlClient.SqlParameterCollection"/>.
/// </summary>
/// <returns>
/// true if the <see cref="T:System.Data.SqlClient.SqlParameterCollection"/> contains the value; otherwise false.
/// </returns>
/// <param name="value">
/// The <see cref="T:System.String"/> value.
/// </param>
bool Contains(string value);
/// <summary>
/// Determines whether the specified <see cref="T:System.Data.SqlClient.SqlParameter"/> is in this <see cref="T:System.Data.SqlClient.SqlParameterCollection"/>.
/// </summary>
/// <returns>
/// true if the <see cref="T:System.Data.SqlClient.SqlParameterCollection"/> contains the value; otherwise false.
/// </returns>
/// <param name="value">
/// The <see cref="T:System.Data.SqlClient.SqlParameter"/> value.
/// </param>
bool Contains(SqlParameter value);
/// <summary>
/// Determines whether the specified <see cref="T:System.Object"/> is in this <see cref="T:System.Data.SqlClient.SqlParameterCollection"/>.
/// </summary>
/// <returns>
/// true if the <see cref="T:System.Data.SqlClient.SqlParameterCollection"/> contains the value; otherwise false.
/// </returns>
/// <param name="value">
/// The <see cref="T:System.Object"/> value.
/// </param>
bool Contains(object value);
/// <summary>
/// Copies all the elements of the current <see cref="T:System.Data.SqlClient.SqlParameterCollection"/> to the specified <see cref="T:System.Data.SqlClient.SqlParameterCollection"/> starting at the specified destination index.
/// </summary>
/// <param name="array">
/// The <see cref="T:System.Data.SqlClient.SqlParameterCollection"/> that is the destination of the elements copied from the current
/// <see cref="T:System.Data.SqlClient.SqlParameterCollection"/>.
/// </param>
/// <param name="index">
/// A 32-bit integer that represents the index in the <see cref="T:System.Data.SqlClient.SqlParameterCollection"/> at which copying starts.
/// </param>
void CopyTo(SqlParameter[] array,
int index);
/// <summary>
/// Copies all the elements of the current <see cref="T:System.Data.SqlClient.SqlParameterCollection"/> to the specified one-dimensional
/// <see cref="T:System.Array"/> starting at the specified destination <see cref="T:System.Array"/> index.
/// </summary>
/// <param name="array">
/// The one-dimensional <see cref="T:System.Array"/> that is the destination of the elements copied from the current
/// <see cref="T:System.Data.SqlClient.SqlParameterCollection"/>.
/// </param>
/// <param name="index">
/// A 32-bit integer that represents the index in the <see cref="T:System.Array"/> at which copying starts.
/// </param>
void CopyTo(Array array,
int index);
/// <summary>
/// Returns an enumerator that iterates through the <see cref="T:System.Data.SqlClient.SqlParameterCollection"/>.
/// </summary>
/// <returns>
/// An <see cref="T:System.Collections.IEnumerator"/> for the <see cref="T:System.Data.SqlClient.SqlParameterCollection"/>.
/// </returns>
IEnumerator GetEnumerator();
/// <summary>
/// Gets the location of the specified <see cref="T:System.Data.SqlClient.SqlParameter"/> within the collection.
/// </summary>
/// <returns>
/// The zero-based location of the specified <see cref="T:System.Data.SqlClient.SqlParameter"/> that is a
/// <see cref="T:System.Data.SqlClient.SqlParameter"/> within the collection. Returns -1 when the object does not exist in the
/// <see cref="T:System.Data.SqlClient.SqlParameterCollection"/>.
/// </returns>
/// <param name="value">
/// The <see cref="T:System.Data.SqlClient.SqlParameter"/> to find.
/// </param>
int IndexOf(SqlParameter value);
/// <summary>
/// Gets the location of the specified <see cref="T:System.Data.SqlClient.SqlParameter"/> with the specified name.
/// </summary>
/// <returns>
/// The zero-based location of the specified <see cref="T:System.Data.SqlClient.SqlParameter"/> with the specified case-sensitive name.
/// Returns -1 when the object does not exist in the <see cref="T:System.Data.SqlClient.SqlParameterCollection"/>.
/// </returns>
/// <param name="parameterName">
/// The case-sensitive name of the <see cref="T:System.Data.SqlClient.SqlParameter"/> to find.
/// </param>
int IndexOf(string parameterName);
/// <summary>
/// Gets the location of the specified <see cref="T:System.Object"/> within the collection.
/// </summary>
/// <returns>
/// The zero-based location of the specified <see cref="T:System.Object"/> that is a <see cref="T:System.Data.SqlClient.SqlParameter"/> within
/// the collection. Returns -1 when the object does not exist in the <see cref="T:System.Data.SqlClient.SqlParameterCollection"/>.
/// </returns>
/// <param name="value">
/// The <see cref="T:System.Object"/> to find.
/// </param>
int IndexOf(object value);
/// <summary>
/// Inserts a <see cref="T:System.Data.SqlClient.SqlParameter"/> object into the <see cref="T:System.Data.SqlClient.SqlParameterCollection"/>
/// at the specified index.
/// </summary>
/// <param name="index">
/// The zero-based index at which value should be inserted.</param><param name="value">A <see cref="T:System.Data.SqlClient.SqlParameter"/> object
/// to be inserted in the <see cref="T:System.Data.SqlClient.SqlParameterCollection"/>.
/// </param>
void Insert(int index,
SqlParameter value);
/// <summary>
/// Inserts an <see cref="T:System.Object"/> into the <see cref="T:System.Data.SqlClient.SqlParameterCollection"/> at the specified index.
/// </summary>
/// <param name="index">
/// The zero-based index at which value should be inserted.
/// </param>
/// <param name="value">
/// An <see cref="T:System.Object"/> to be inserted in the <see cref="T:System.Data.SqlClient.SqlParameterCollection"/>.
/// </param>
void Insert(int index,
object value);
/// <summary>
/// Removes the specified <see cref="T:System.Data.SqlClient.SqlParameter"/> from the collection.
/// </summary>
/// <param name="value">
/// A <see cref="T:System.Data.SqlClient.SqlParameter"/> object to remove from the collection.
/// </param>
/// <exception cref="T:System.InvalidCastException">
/// The parameter is not a <see cref="T:System.Data.SqlClient.SqlParameter"/>.
/// </exception>
/// <exception cref="T:System.SystemException">
/// The parameter does not exist in the collection.
/// </exception>
void Remove(SqlParameter value);
/// <summary>
/// Removes the specified <see cref="T:System.Data.SqlClient.SqlParameter"/> from the collection.
/// </summary>
/// <param name="value">
/// The object to remove from the collection.
/// </param>
void Remove(object value);
/// <summary>
/// Removes the <see cref="T:System.Data.SqlClient.SqlParameter"/> from the <see cref="T:System.Data.SqlClient.SqlParameterCollection"/>
/// at the specified index.
/// </summary>
/// <param name="index">
/// The zero-based index of the <see cref="T:System.Data.SqlClient.SqlParameter"/> object to remove.
/// </param>
void RemoveAt(int index);
/// <summary>
/// Removes the <see cref="T:System.Data.SqlClient.SqlParameter"/> from the <see cref="T:System.Data.SqlClient.SqlParameterCollection"/>
/// at the specified parameter name.
/// </summary>
/// <param name="parameterName">
/// The name of the <see cref="T:System.Data.SqlClient.SqlParameter"/> to remove.
/// </param>
void RemoveAt(string parameterName);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,460 @@
namespace SystemInterface.Globalization
{
using System;
using System.Globalization;
using System.Runtime;
using System.Runtime.InteropServices;
using System.Security;
/// <summary>
/// Gets the default calendar used by the culture.
/// </summary>
public interface ICultureInfo
{
#region Public Properties
/// <summary>
/// Gets the default calendar used by the culture.
/// </summary>
/// <returns>
/// A System.Globalization.Calendar that represents the default calendar used
/// by the culture.
/// </returns>
Calendar Calendar { get; }
/// <summary>
/// Gets the System.Globalization.CompareInfo that defines how to compare strings
/// for the culture.
/// </summary>
/// <returns>
/// The System.Globalization.CompareInfo that defines how to compare strings
/// for the culture.
/// </returns>
CompareInfo CompareInfo { get; }
///
/// <Summary>
/// Gets the culture types that pertain to the current System.Globalization.CultureInfo
/// object.
/// </Summary>
/// <Returns>
/// A bitwise combination of one or more System.Globalization.CultureTypes values.
/// There is no default value.
/// </returns>
[ComVisible(false)]
CultureTypes CultureTypes { get; }
/// <Summary>
/// Gets or sets a System.Globalization.DateTimeFormatInfo that defines the culturally
/// appropriate format of displaying dates and times.
/// </Summary>
/// <Returns>
/// A System.Globalization.DateTimeFormatInfo that defines the culturally appropriate
/// format of displaying dates and times.i
/// </returns>
/// <exception cref="ArgumentNullException">
/// The property is set to null.
/// </exception>>
/// <exception cref="InvalidOperationException">
/// The System.Globalization.CultureInfo.DateTimeFormat property or any of the
/// System.Globalization.DateTimeFormatInfo properties is set, and the System.Globalization.CultureInfo
/// is read-only.
/// </exception>
DateTimeFormatInfo DateTimeFormat { get; set; }
/// <Summary>
/// Gets the culture name in the format "&lt;languagefull&gt; (&lt;country/regionfull&gt;)"
/// in the language of the localized version of .NET Framework.
/// </Summary>
/// <Returns>
/// The culture name in the format "&lt;languagefull&gt; (&lt;country/regionfull&gt;)" in
/// the language of the localized version of .NET Framework, where &lt;languagefull&gt;
/// is the full name of the language and &lt;country/regionfull&gt; is the full name
/// of the country/region.
/// </Returns>
string DisplayName { get; }
/// <Summary>
/// Gets the culture name in the format "&lt;languagefull&gt; (&lt;country/regionfull&gt;)"
/// in English.
/// </Summary>
/// <Returns>
/// The culture name in the format "&lt;languagefull&gt; (&lt;country/regionfull&gt;)" in
/// English, where &lt;languagefull&gt; is the full name of the language and &lt;country/regionfull&gt;
/// is the full name of the country/region.
/// </Returns>
string EnglishName { get; }
/// <Summary>
/// Deprecated. Gets the RFC 4646 standard identification for a language.
/// </Summary>
/// <Returns>
/// A string that is the RFC 4646 standard identification for a language.
/// </Returns>
[ComVisible(false)]
string IetfLanguageTag { get; }
/// <Summary>
/// Gets a value indicating whether the current System.Globalization.CultureInfo
/// represents a neutral culture.
/// </Summary>
/// <Returns>
/// true if the current System.Globalization.CultureInfo represents a neutral
/// culture; otherwise, false.
/// </Returns>
bool IsNeutralCulture { get; }
/// <Summary>
/// Gets a value indicating whether the current System.Globalization.CultureInfo
/// is read-only.
/// </Summary>
/// <Returns>
/// true if the current System.Globalization.CultureInfo is read-only; otherwise,
/// false. The default is false.
/// </Returns>
bool IsReadOnly { get; }
/// <Summary>
/// Gets the active input locale identifier.
/// </Summary>
/// <Returns>
/// A 32-bit signed number that specifies an input locale identifier.
/// </Returns>
[ComVisible(false)]
int KeyboardLayoutId { get; }
/// <Summary>
/// Gets the culture identifier for the current System.Globalization.CultureInfo.
/// </Summary>
/// <Returns>
/// The culture identifier for the current System.Globalization.CultureInfo.
/// </Returns>
// ReSharper disable once InconsistentNaming
int LCID { get; }
/// <Summary>
/// Gets the culture name in the format "languagecode2-country/regioncode2".
/// </Summary>
/// <Returns>
/// The culture name in the format "languagecode2-country/regioncode2", where
/// languagecode2 is a lowercase two-letter code derived from ISO 639-1 and country/regioncode2
/// is an uppercase two-letter code derived from ISO 3166.
/// </Returns>
string Name { get; }
/// <Summary>
/// Gets the System.Globalization.CultureInfo object that is culture-independent
/// (invariant).
/// </Summary>
/// <Returns>
/// The object that is culture-independent (invariant).
/// </Returns>
CultureInfo InvariantCulture { get; }
/// <Summary>
/// Gets the culture name, consisting of the language, the country/region, and
/// the optional script, that the culture is set to display.
/// </Summary>
/// <Returns>
/// The culture name. consisting of the full name of the language, the full name
/// of the country/region, and the optional script. The format is discussed in
/// the description of the System.Globalization.CultureInfo class.
/// </Returns>
string NativeName { get; }
/// <Summary>
/// Gets or sets a System.Globalization.NumberFormatInfo that defines the culturally
/// appropriate format of displaying numbers, currency, and percentage.
///
/// </Summary>
/// <Returns>
/// A System.Globalization.NumberFormatInfo that defines the culturally appropriate
/// format of displaying numbers, currency, and percentage.
/// </Returns>
/// <exception cref="ArgumentNullException">
/// The property is set to null.
/// </exception>
/// <exception cref="InvalidOperationException">
/// The System.Globalization.CultureInfo.NumberFormat property or any of the
/// System.Globalization.NumberFormatInfo properties is set, and the System.Globalization.CultureInfo
/// is read-only.
/// </exception>:
NumberFormatInfo NumberFormat { get; set; }
///
/// <Summary>
/// Gets the list of calendars that can be used by the culture.
/// </Summary>
/// <Returns>
/// An array of type System.Globalization.Calendar that represents the calendars
/// that can be used by the culture represented by the current System.Globalization.CultureInfo.
/// </Returns>
Calendar[] OptionalCalendars { get; }
/// <Summary>
/// Gets the System.Globalization.TextInfo that defines the writing system associated
/// with the culture.
/// </Summary>
/// <Returns>
/// The System.Globalization.TextInfo that defines the writing system associated
/// with the culture.
/// </Returns>
TextInfo TextInfo { get; }
/// <Summary>
/// Gets the ISO 639-2 three-letter code for the language of the current System.Globalization.CultureInfo.
/// </Summary>
/// <Returns>
/// The ISO 639-2 three-letter code for the language of the current System.Globalization.CultureInfo.
/// </Returns>
// ReSharper disable once InconsistentNaming
string ThreeLetterISOLanguageName { get; }
/// <Summary>
/// Gets the three-letter code for the language as defined in the Windows API.
/// </Summary>
/// <Returns>
/// The three-letter code for the language as defined in the Windows API.
/// </Returns>
string ThreeLetterWindowsLanguageName { get; }
/// <Summary>
/// Gets the ISO 639-1 two-letter code for the language of the current System.Globalization.CultureInfo.
/// </Summary>
/// <Returns>
/// The ISO 639-1 two-letter code for the language of the current System.Globalization.CultureInfo.
/// </Returns>
// ReSharper disable once InconsistentNaming
string TwoLetterISOLanguageName { get; }
/// <Summary>
/// Gets a value indicating whether the current System.Globalization.CultureInfo
/// uses the user-selected culture settings.
/// </Summary>
/// <Returns>
/// true if the current System.Globalization.CultureInfo uses the user-selected
/// culture settings; otherwise, false.
/// </Returns>
bool UseUserOverride { get; }
#endregion
#region Public Methods and Operators
/// <Summary>
/// Refreshes cached culture-related information.
/// </Summary>
void ClearCachedData();
/// <Summary>
/// Creates a copy of the current System.Globalization.CultureInfo.
/// </Summary>
/// <Returns>
/// A copy of the current System.Globalization.CultureInfo.
/// </Returns>
[SecuritySafeCritical]
object Clone();
/// <Summary>
/// Creates a System.Globalization.CultureInfo that represents the specific culture
/// that is associated with the specified name.
/// </Summary>
/// <Param name="name">
/// A predefined System.Globalization.CultureInfo name or the name of an existing
/// System.Globalization.CultureInfo object. name is not case-sensitive.
/// </Param>
/// <Returns>
/// A System.Globalization.CultureInfo object that represents:The invariant culture,
/// if name is an empty string ("").-or- The specific culture associated with
/// name, if name is a neutral culture.-or- The culture specified by name, if
/// name is already a specific culture.
/// </Returns>
CultureInfo CreateSpecificCulture(string name);
/// <Summary>
/// Determines whether the specified object is the same culture as the current
/// System.Globalization.CultureInfo.
/// </Summary>
/// <Param name="value">
/// The object to compare with the current System.Globalization.CultureInfo.
/// </Param>
/// <Returns>
/// true if value is the same culture as the current System.Globalization.CultureInfo;
/// otherwise, false.
/// </Returns>
bool Equals(object value);
/// <Summary>
/// Gets an alternate user interface culture suitable for console applications
/// when the default graphic user interface culture is unsuitable.
/// </Summary>
/// <Returns>
/// An alternate culture that is used to read and display text on the console.
/// </Returns>
[ComVisible(false)]
[SecuritySafeCritical]
CultureInfo GetConsoleFallbackUICulture();
///
/// <Summary>
/// Retrieves a cached, read-only instance of a culture by using the specified
/// culture identifier.
///
/// Parameters:
/// culture:
/// A locale identifier (LCID).
///
/// </Summary>
/// <Returns>
/// A read-only instance of the specified culture.
/// </Returns>
/// <exception cref="ArgumentOutOfRangeException">
/// culture is less than zero.
/// </exception>
/// <exception cref="CultureNotFoundException">
/// culture specifies a culture that is not supported.
/// </exception>
CultureInfo GetCultureInfo(int culture);
/// <Summary>
/// Retrieves a cached, read-only instance of a culture by using the specified
/// culture name.
/// </Summary>
/// Parameters:
/// name:
/// The name of a culture. name is not case-sensitive.
/// <Returns>
/// A read-only instance of the specified culture.
/// </Returns>
/// <exception cref="ArgumentNullException">
/// name is null.
/// </exception>
/// <exception cref="CultureNotFoundException">
/// name specifies a culture that is not supported.
/// </exception>
CultureInfo GetCultureInfo(string name);
/// <Summary>
/// Retrieves a cached, read-only instance of a culture. Parameters specify a
/// culture that is initialized with the System.Globalization.TextInfo and System.Globalization.CompareInfo
/// objects specified by another culture.
/// </summary>
/// <param name="name">
/// The name of a culture. name is not case-sensitive.///
/// </param>
/// <param name="altName">
/// The name of a culture that supplies the System.Globalization.TextInfo and
/// System.Globalization.CompareInfo objects used to initialize name. altName
/// is not case-sensitive.
/// </param>
/// <Returns>
/// A read-only instance of the specified culture.
/// </Returns>
/// <exception cref="ArgumentNullException">
/// name or altName is null.
/// </exception>
/// <exception cref="CultureNotFoundException">
/// name or altName specifies a culture that is not supported.
/// </exception>
CultureInfo GetCultureInfo(string name,
string altName);
/// <Summary>
/// Deprecated. Retrieves a read-only System.Globalization.CultureInfo object
/// having linguistic characteristics that are identified by the specified RFC
/// 4646 language tag.
/// </Summary>
/// <Param name="name">
/// The name of a language as specified by the RFC 4646 standard.
/// </Param>
/// <Returns>
/// A read-only System.Globalization.CultureInfo object.
/// </Returns>
/// <exception cref="ArgumentNullException">
/// name is null.
/// </exception>
/// <exception cref="CultureNotFoundException">
/// name does not correspond to a supported culture.
/// </exception>
CultureInfo GetCultureInfoByIetfLanguageTag(string name);
///
/// <Summary>
/// Gets the list of supported cultures filtered by the specified System.Globalization.CultureTypes
/// parameter.
///
/// Parameters:
/// types:
/// A bitwise combination of the enumeration values that filter the cultures
/// to retrieve.
///
/// </Summary>
/// <Returns>
/// An array that contains the cultures specified by the types parameter. The
/// array of cultures is unsorted.
/// </Returns>
/// <exception cref="ArgumentOutOfRangeException">
/// types specifies an invalid combination of System.Globalization.CultureTypes
/// </exception>
CultureInfo[] GetCultures(CultureTypes types);
/// <Summary>
/// Gets an object that defines how to format the specified type.
/// Parameters:
/// formatType:
/// The System.Type for which to get a formatting object. This method only supports
/// the System.Globalization.NumberFormatInfo and System.Globalization.DateTimeFormatInfo
/// types.
/// </Summary>
/// <Returns>
/// The value of the System.Globalization.CultureInfo.NumberFormat property,
/// which is a System.Globalization.NumberFormatInfo containing the default number
/// format information for the current System.Globalization.CultureInfo, if formatType
/// is the System.Type object for the System.Globalization.NumberFormatInfo class.-or-
/// The value of the System.Globalization.CultureInfo.DateTimeFormat property,
/// which is a System.Globalization.DateTimeFormatInfo containing the default
/// date and time format information for the current System.Globalization.CultureInfo,
/// if formatType is the System.Type object for the System.Globalization.DateTimeFormatInfo
/// class.-or- null, if formatType is any other object.
/// </Returns>
[SecuritySafeCritical]
object GetFormat(Type formatType);
/// <Summary>
/// Serves as a hash function for the current System.Globalization.CultureInfo,
/// suitable for hashing algorithms and data structures, such as a hash table.
/// </Summary>
/// <Returns>
/// A hash code for the current System.Globalization.CultureInfo.
/// </Returns>
[TargetedPatchingOptOut("Performance critical to inline across NGen image boundaries")]
int GetHashCode();
/// <Summary>
/// Returns a read-only wrapper around the specified System.Globalization.CultureInfo.
/// Parameters:
/// ci:
/// The System.Globalization.CultureInfo to wrap.
///
/// </Summary>
/// <Returns>
/// A read-only System.Globalization.CultureInfo wrapper around ci.
/// </Returns>
/// <exception cref="ArgumentNullException">
/// ci is null.
/// </exception>
[SecuritySafeCritical]
CultureInfo ReadOnly(CultureInfo ci);
/// <Summary>
/// Returns a string containing the name of the current System.Globalization.CultureInfo
/// in the format "languagecode2-country/regioncode2".
/// </Summary>
/// <Returns>
/// A string containing the name of the current System.Globalization.CultureInfo.
/// </Returns>
string ToString();
#endregion
}
}

Просмотреть файл

@ -0,0 +1,30 @@
namespace SystemInterface.IO
{
using System.IO;
/// <summary>
/// Defines the contract for the factory responsible for the creation of <see cref="IDirectoryInfo"/> instances.
/// </summary>
public interface IDirectoryInfoFactory
{
#region Public Methods and Operators
/// <summary>
/// Initializes a new instance of the <see cref="IDirectoryInfo"/> class with the specified instance.
/// </summary>
/// <param name="directoryInfo">
/// A <see cref="DirectoryInfo"/> object.
/// </param>
IDirectoryInfo Create(DirectoryInfo directoryInfo);
/// <summary>
/// Initializes a new instance of the <see cref="IDirectoryInfo"/> class on the specified path.
/// </summary>
/// <param name="path">
/// A string specifying the path on which to create the <see cref="IDirectoryInfo"/>.
/// </param>
IDirectoryInfo Create(string path);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,30 @@
namespace SystemInterface.IO
{
using System.IO;
/// <summary>
/// Defines the contract for the factory responsible for the creation of <see cref="IFileInfo"/> instances.
/// </summary>
public interface IFileInfoFactory
{
#region Public Methods and Operators
/// <summary>
/// Initializes a new instance of the <see cref="IFileInfo"/> class with the specified instance.
/// </summary>
/// <param name="fileInfo">
/// A <see cref="FileInfo"/> object.
/// </param>
IFileInfo Create(FileInfo fileInfo);
/// <summary>
/// Initializes a new instance of the <see cref="IFileInfo"/> class on the specified fileName.
/// </summary>
/// <param name="fileName">
/// The fully qualified name of the new file, or the relative file name.
/// </param>
IFileInfo Create(string fileName);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,183 @@
namespace SystemInterface.IO
{
using System.IO;
using System.Security.AccessControl;
using SystemInterface.Microsoft.Win32.SafeHandles;
/// <summary>
/// Factory that creates a new <see cref="IFileStreamFactory"/> instance.
/// </summary>
public interface IFileStreamFactory
{
#region Public Methods and Operators
/// <summary>
/// Creates a new instance of the <see cref='IFileStream'/> class.
/// </summary>
/// <returns>
/// The <see cref="IFileStream"/>.
/// </returns>
IFileStream Create(string path,
FileMode fileMode);
/// <summary>
/// Creates a new instance of the <see cref='IFileStream'/> class.
/// </summary>
/// <param name="stream">
/// The file stream.
/// </param>
/// <returns>
/// The <see cref="IFileStream"/>.
/// </returns>
IFileStream Create(Stream stream);
/// <summary>
/// Creates a new instance of the <see cref='IFileStream'/> class passing the memory stream.
/// </summary>
/// <param name="fileStream">
/// The file stream.
/// </param>
/// <returns>
/// The <see cref="IFileStream"/>.
/// </returns>
IFileStream Create(FileStream fileStream);
/// <summary>
/// Creates a new instance of the <see cref='IFileStream'/> class passing the byte buffer.
/// </summary>
/// <param name="handle">A file handle for the file that the current FileStream object will encapsulate. </param>
/// <param name="access">A FileAccess constant that sets the CanRead and CanWrite properties of the FileStream object. </param>
/// <returns>
/// The <see cref="IFileStream"/>.
/// </returns>
IFileStream Create(ISafeFileHandle handle,
FileAccess access);
/// <summary>
/// Initializes a new instance of the <see cref="T:SystemWrapper.IO.FileStreamWrap"/> class for the specified file handle, with the specified read/write permission, and buffer size.
/// </summary>
/// <param name="handle">A file handle for the file that the current FileStream object will encapsulate. </param>
/// <param name="access">A FileAccess constant that sets the CanRead and CanWrite properties of the FileStream object. </param>
/// <param name="bufferSize">A positive Int32 value greater than 0 indicating the buffer size. For bufferSize values between one and eight, the actual buffer size is set to eight bytes. </param>
IFileStream Create(ISafeFileHandle handle,
FileAccess access,
int bufferSize);
/// <summary>
/// Initializes a new instance of the <see cref="T:SystemWrapper.IO.FileStreamWrap"/> class with the specified path and creation mode.
/// </summary>
/// <param name="path">A relative or absolute path for the file that the current FileStream object will encapsulate.</param>
/// <param name="mode">A FileMode constant that determines how to open or create the file.</param>
/// <param name="access">A FileAccess constant that determines how the file can be accessed by the FileStream object. This gets the CanRead and CanWrite properties of the FileStream object. CanSeek is true if path specifies a disk file.</param>
IFileStream Create(string path,
FileMode mode,
FileAccess access);
/// <summary>
/// Initializes a new instance of the <see cref="T:SystemWrapper.IO.FileStreamWrap"/> class for the specified file handle, with the specified read/write permission, and buffer size, and synchronous or asynchronous state.
/// </summary>
/// <param name="handle">A file handle for the file that the current FileStream object will encapsulate. </param>
/// <param name="access">A FileAccess constant that sets the CanRead and CanWrite properties of the FileStream object. </param>
/// <param name="bufferSize">A positive Int32 value greater than 0 indicating the buffer size. For bufferSize values between one and eight, the actual buffer size is set to eight bytes. </param>
/// <param name="isAsync"> true if the handle was opened asynchronously (that is, in overlapped I/O mode); otherwise, false. </param>
IFileStream Create(ISafeFileHandle handle,
FileAccess access,
int bufferSize,
bool isAsync);
/// <summary>
/// Initializes a new instance of the <see cref="T:SystemWrapper.IO.FileStreamWrap"/> class with the specified path, creation mode, read/write permission, and sharing permission.
/// </summary>
/// <param name="path">A relative or absolute path for the file that the current FileStream object will encapsulate.</param>
/// <param name="mode">A FileMode constant that determines how to open or create the file.</param>
/// <param name="access">A FileAccess constant that determines how the file can be accessed by the FileStream object. This gets the CanRead and CanWrite properties of the FileStream object. CanSeek is true if path specifies a disk file.</param>
/// <param name="share">A FileShare constant that determines how the file will be shared by processes. </param>
IFileStream Create(string path,
FileMode mode,
FileAccess access,
FileShare share);
/// <summary>
/// Initializes a new instance of the <see cref="T:SystemWrapper.IO.FileStreamWrap"/> class with the specified path, creation mode, read/write permission, and sharing permission, and buffer size.
/// </summary>
/// <param name="path">A relative or absolute path for the file that the current FileStream object will encapsulate.</param>
/// <param name="mode">A FileMode constant that determines how to open or create the file.</param>
/// <param name="access">A FileAccess constant that determines how the file can be accessed by the FileStream object. This gets the CanRead and CanWrite properties of the FileStream object. CanSeek is true if path specifies a disk file.</param>
/// <param name="share">A FileShare constant that determines how the file will be shared by processes. </param>
/// <param name="bufferSize">A positive Int32 value greater than 0 indicating the buffer size. For bufferSize values between one and eight, the actual buffer size is set to eight bytes. </param>
IFileStream Create(string path,
FileMode mode,
FileAccess access,
FileShare share,
int bufferSize);
/// <summary>
/// Initializes a new instance of the <see cref="T:SystemWrapper.IO.FileStreamWrap"/> class with the specified path, creation mode, read/write permission, and sharing permission, and buffer size.
/// </summary>
/// <param name="path">A relative or absolute path for the file that the current FileStream object will encapsulate.</param>
/// <param name="mode">A FileMode constant that determines how to open or create the file.</param>
/// <param name="access">A FileAccess constant that determines how the file can be accessed by the FileStream object. This gets the CanRead and CanWrite properties of the FileStream object. CanSeek is true if path specifies a disk file.</param>
/// <param name="share">A FileShare constant that determines how the file will be shared by processes. </param>
/// <param name="bufferSize">A positive Int32 value greater than 0 indicating the buffer size. For bufferSize values between one and eight, the actual buffer size is set to eight bytes.</param>
/// <param name="useAsync">A positive Int32 value greater than 0 indicating the buffer size. For bufferSize values between one and eight, the actual buffer size is set to eight bytes.</param>
IFileStream Create(string path,
FileMode mode,
FileAccess access,
FileShare share,
int bufferSize,
bool useAsync);
/// <summary>
/// Initializes a new instance of the <see cref="T:SystemWrapper.IO.FileStreamWrap"/> class with the specified path, creation mode, read/write and sharing permission, the access other FileStreams can have to the same file, the buffer size, and additional file options.
/// </summary>
/// <param name="path">A relative or absolute path for the file that the current FileStream object will encapsulate.</param>
/// <param name="mode">A FileMode constant that determines how to open or create the file.</param>
/// <param name="access">A FileAccess constant that determines how the file can be accessed by the FileStream object. This gets the CanRead and CanWrite properties of the FileStream object. CanSeek is true if path specifies a disk file.</param>
/// <param name="share">A FileShare constant that determines how the file will be shared by processes. </param>
/// <param name="bufferSize">A positive Int32 value greater than 0 indicating the buffer size. For bufferSize values between one and eight, the actual buffer size is set to eight bytes.</param>
/// <param name="options">A FileOptions value that specifies additional file options.</param>
IFileStream Create(string path,
FileMode mode,
FileAccess access,
FileShare share,
int bufferSize,
FileOptions options);
/// <summary>
/// Initializes a new instance of the <see cref="T:SystemWrapper.IO.FileStreamWrap"/> class with the specified path, creation mode, access rights and sharing permission, the buffer size, and additional file options.
/// </summary>
/// <param name="path">A relative or absolute path for the file that the current FileStream object will encapsulate.</param>
/// <param name="mode">A FileMode constant that determines how to open or create the file.</param>
/// <param name="rights">A FileSystemRights constant that determines the access rights to use when creating access and audit rules for the file.</param>
/// <param name="share">A FileShare constant that determines how the file will be shared by processes. </param>
/// <param name="bufferSize">A positive Int32 value greater than 0 indicating the buffer size. For bufferSize values between one and eight, the actual buffer size is set to eight bytes.</param>
/// <param name="options">A FileOptions value that specifies additional file options.</param>
IFileStream Create(string path,
FileMode mode,
FileSystemRights rights,
FileShare share,
int bufferSize,
FileOptions options);
/// <summary>
/// Initializes a new instance of the <see cref="T:SystemWrapper.IO.FileStreamWrap"/> class with the specified path, creation mode, access rights and sharing permission, the buffer size, additional file options, access control and audit security.
/// </summary>
/// <param name="path">A relative or absolute path for the file that the current FileStream object will encapsulate.</param>
/// <param name="mode">A FileMode constant that determines how to open or create the file.</param>
/// <param name="rights">A FileSystemRights constant that determines the access rights to use when creating access and audit rules for the file.</param>
/// <param name="share">A FileShare constant that determines how the file will be shared by processes. </param>
/// <param name="bufferSize">A positive Int32 value greater than 0 indicating the buffer size. For bufferSize values between one and eight, the actual buffer size is set to eight bytes.</param>
/// <param name="options">A FileOptions value that specifies additional file options.</param>
/// <param name="fileSecurity">A FileSecurity constant that determines the access control and audit security for the file.</param>
IFileStream Create(string path,
FileMode mode,
FileSystemRights rights,
FileShare share,
int bufferSize,
FileOptions options,
FileSecurity fileSecurity);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,48 @@
namespace SystemInterface.IO
{
/// <summary>
/// Factory that creates a new <see cref="IFileSystemWatcher"/> instance.
/// </summary>
public interface IFileSystemWatcherFactory
{
#region Public Methods and Operators
/// <summary>
/// Creates a new instance of the <see cref='IFileSystemWatcher'/> class.
/// </summary>
/// <returns>
/// The <see cref="IFileSystemWatcher"/>.
/// </returns>
IFileSystemWatcher Create();
/// <summary>
/// Creates a new instance of the <see cref="System.IO.FileSystemWatcher"/> class,
/// given the specified directory to monitor.
/// </summary>
/// <param name="path">
/// The path.
/// </param>
/// <returns>
/// The <see cref="IFileSystemWatcher"/>.
/// </returns>
IFileSystemWatcher Create(string path);
/// <summary>
/// Initializes a new instance of the <see cref='System.IO.FileSystemWatcher'/> class,
/// given the specified directory and type of files to monitor.
/// </summary>
/// <param name="path">
/// The path.
/// </param>
/// <param name="filter">
/// The filter.
/// </param>
/// <returns>
/// The <see cref="IFileSystemWatcher"/>.
/// </returns>
IFileSystemWatcher Create(string path,
string filter);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,151 @@
namespace SystemInterface.IO
{
using System.IO;
/// <summary>
/// Factory that creates a new <see cref="IMemoryStreamFactory"/> instance.
/// </summary>
public interface IMemoryStreamFactory
{
#region Public Methods and Operators
/// <summary>
/// Creates a new instance of the <see cref='IMemoryStream'/> class.
/// </summary>
/// <returns>
/// The <see cref="IMemoryStream"/>.
/// </returns>
IMemoryStream Create();
/// <summary>
/// Creates a new instance of the <see cref='IMemoryStream'/> class passing the stream.
/// </summary>
/// <param name="stream">
/// The stream.
/// </param>
/// <returns>
/// The <see cref="IMemoryStream"/>.
/// </returns>
IMemoryStream Create(Stream stream);
/// <summary>
/// Creates a new instance of the <see cref='IMemoryStream'/> class passing the memory stream.
/// </summary>
/// <param name="memoryStream">
/// The memory stream.
/// </param>
/// <returns>
/// The <see cref="IMemoryStream"/>.
/// </returns>
IMemoryStream Create(MemoryStream memoryStream);
/// <summary>
/// Creates a new instance of the <see cref='IMemoryStream'/> class passing the byte buffer.
/// </summary>
/// <param name="buffer">
/// The buffer.
/// </param>
/// <returns>
/// The <see cref="IMemoryStream"/>.
/// </returns>
IMemoryStream Create(byte[] buffer);
/// <summary>
/// Creates a new instance of the <see cref='IMemoryStream'/> class passing the capacity.
/// </summary>
/// <param name="capacity">
/// The capacity.
/// </param>
/// <returns>
/// The <see cref="IMemoryStream"/>.
/// </returns>
IMemoryStream Create(int capacity);
/// <summary>
/// Creates a new instance of the <see cref='IMemoryStream'/> class passing the byte buffer and the write state.
/// </summary>
/// <param name="buffer">
/// The buffer.
/// </param>
/// <param name="writable">
/// The writable.
/// </param>
/// <returns>
/// The <see cref="IMemoryStream"/>.
/// </returns>
IMemoryStream Create(byte[] buffer,
bool writable);
/// <summary>
/// Creates a new instance of the <see cref='IMemoryStream'/> class passing the byte buffer, the index and the count.
/// </summary>
/// <param name="buffer">
/// The buffer.
/// </param>
/// <param name="index">
/// The index.
/// </param>
/// <param name="count">
/// The count.
/// </param>
/// <returns>
/// The <see cref="IMemoryStream"/>.
/// </returns>
IMemoryStream Create(byte[] buffer,
int index,
int count);
/// <summary>
/// Creates a new instance of the <see cref='IMemoryStream'/> class passing the byte buffer, the index, the count and the write state.
/// </summary>
/// <param name="buffer">
/// The buffer.
/// </param>
/// <param name="index">
/// The index.
/// </param>
/// <param name="count">
/// The count.
/// </param>
/// <param name="writable">
/// The writable.
/// </param>
/// <returns>
/// The <see cref="IMemoryStream"/>.
/// </returns>
IMemoryStream Create(byte[] buffer,
int index,
int count,
bool writable);
/// <summary>
/// Creates a new instance of the <see cref='IMemoryStream'/> class passing the byte buffer, the index, the count, the write state and
/// the visibility.
/// </summary>
/// <param name="buffer">
/// The buffer.
/// </param>
/// <param name="index">
/// The index.
/// </param>
/// <param name="count">
/// The count.
/// </param>
/// <param name="writable">
/// The writable.
/// </param>
/// <param name="publiclyVisible">
/// The publicly visible.
/// </param>
/// <returns>
/// The <see cref="IMemoryStream"/>.
/// </returns>
IMemoryStream Create(byte[] buffer,
int index,
int count,
bool writable,
bool publiclyVisible);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,219 @@
namespace SystemInterface.IO
{
using System.IO;
using System.Text;
/// <summary>
/// Factory that creates a new <see cref="IStreamReader"/> instance.
/// </summary>
public interface IStreamReaderFactory
{
#region Public Methods and Operators
/// <summary>
/// Creates a new instance of the <see cref="IStreamReader"/> class on the specified path.
/// </summary>
/// <param name="textReader">
/// A <see cref="T:System.IO.TextReader"/> object.
/// </param>
/// <returns>
/// The <see cref="IStreamReader"/>.
/// </returns>
IStreamReader Create(TextReader textReader);
/// <summary>
/// Creates a new instance of the <see cref='IStreamReader'/> class on the specified path.
/// </summary>
/// <param name="streamReader">
/// A <see cref="T:System.IO.StreamReader"/> object.
/// </param>
/// <returns>
/// The <see cref="IStreamReader"/>.
/// </returns>
IStreamReader Create(StreamReader streamReader);
/// <summary>
/// Creates a new instance of the <see cref='IStreamReader'/> class for the specified stream.
/// </summary>
/// <param name="stream">
/// The stream to write to.
/// </param>
/// <returns>
/// The <see cref="IStreamReader"/>.
/// </returns>
IStreamReader Create(Stream stream);
/// <summary>
/// Creates a new instance of the <see cref='IStreamReader'/> class for the specified stream.
/// </summary>
/// <param name="stream">
/// The stream to write to.
/// </param>
/// <returns>
/// The <see cref="IStreamReader"/>.
/// </returns>
IStreamReader Create(IStream stream);
/// <summary>
/// Creates a new instance of the <see cref='IStreamReader'/> class for the specified stream.
/// </summary>
/// <param name="path">
/// The complete file path to be read.
/// </param>
/// <returns>
/// The <see cref="IStreamReader"/>.
/// </returns>
IStreamReader Create(string path);
/// <summary>
/// Creates a new instance of the <see cref='IStreamReader'/> class for the specified stream, with the specified byte order mark detection option.
/// </summary>
/// <param name="stream">
/// The stream to be read.
/// </param>
/// <param name="detectEncodingFromByteOrderMarks">
/// Indicates whether to look for byte order marks at the beginning of the file.
/// </param>
/// <returns>
/// The <see cref="IStreamReader"/>.
/// </returns>
IStreamReader Create(Stream stream,
bool detectEncodingFromByteOrderMarks);
/// <summary>
/// Creates a new instance of the <see cref='IStreamReader'/> class for the specified stream, with the specified character encoding.
/// </summary>
/// <param name="stream">
/// The stream to be read.
/// </param>
/// <param name="encoding">
/// The character encoding to use.
/// </param>
/// <returns>
/// The <see cref="IStreamReader"/>.
/// </returns>
IStreamReader Create(Stream stream,
Encoding encoding);
/// <summary>
/// Creates a new instance of the <see cref='IStreamReader'/> class for the specified file name, with the specified byte order mark
/// detection option.
/// </summary>
/// <param name="path">
/// The complete file path to be read.
/// </param>
/// <param name="detectEncodingFromByteOrderMarks">
/// Indicates whether to look for byte order marks at the beginning of the file.
/// </param>
/// <returns>
/// The <see cref="IStreamReader"/>.
/// </returns>
IStreamReader Create(string path,
bool detectEncodingFromByteOrderMarks);
/// <summary>
/// Creates a new instance of the <see cref='IStreamReader'/> class for the specified file name, with the specified character encoding.
/// </summary>
/// <param name="path">
/// The complete file path to be read.
/// </param>
/// <param name="encoding">
/// The character encoding to use.
/// </param>
/// <returns>
/// The <see cref="IStreamReader"/>.
/// </returns>
IStreamReader Create(string path,
Encoding encoding);
/// <summary>
/// Creates a new instance of the <see cref='IStreamReader'/> class for the specified stream, with the specified character encoding
/// and byte order mark detection option.
/// </summary>
/// <param name="stream">
/// The stream to be read.
/// </param>
/// <param name="encoding">
/// The character encoding to use.
/// </param>
/// <param name="detectEncodingFromByteOrderMarks">
/// Indicates whether to look for byte order marks at the beginning of the file.
/// </param>
/// <returns>
/// The <see cref="IStreamReader"/>.
/// </returns>
IStreamReader Create(Stream stream,
Encoding encoding,
bool detectEncodingFromByteOrderMarks);
/// <summary>
/// Creates a new instance of the <see cref='IStreamReader'/> class for the specified file name, with the specified character encoding
/// and byte order mark detection option.
/// </summary>
/// <param name="path">
/// The complete file path to be read.
/// </param>
/// <param name="encoding">
/// The character encoding to use.
/// </param>
/// <param name="detectEncodingFromByteOrderMarks">
/// Indicates whether to look for byte order marks at the beginning of the file.
/// </param>
/// <returns>
/// The <see cref="IStreamReader"/>.
/// </returns>
IStreamReader Create(string path,
Encoding encoding,
bool detectEncodingFromByteOrderMarks);
/// <summary>
/// Creates a new instance of the <see cref='IStreamReader'/> class for the specified stream, with the specified character encoding and
/// byte order mark detection option, and buffer size.
/// </summary>
/// <param name="stream">
/// The stream to be read.
/// </param>
/// <param name="encoding">
/// The character encoding to use.
/// </param>
/// <param name="detectEncodingFromByteOrderMarks">
/// Indicates whether to look for byte order marks at the beginning of the file.
/// </param>
/// <param name="bufferSize">
/// The minimum buffer size.
/// </param>
/// <returns>
/// The <see cref="IStreamReader"/>.
/// </returns>
IStreamReader Create(Stream stream,
Encoding encoding,
bool detectEncodingFromByteOrderMarks,
int bufferSize);
/// <summary>
/// Creates a new instance of the <see cref='IStreamReader'/> class for the specified file name, with the specified character encoding and
/// byte order mark detection option.
/// </summary>
/// <param name="path">
/// The complete file path to be read.
/// </param>
/// <param name="encoding">
/// The character encoding to use.
/// </param>
/// <param name="detectEncodingFromByteOrderMarks">
/// Indicates whether to look for byte order marks at the beginning of the file.
/// </param>
/// <param name="bufferSize">
/// The minimum buffer size, in number of 16-bit characters.
/// </param>
/// <returns>
/// The <see cref="IStreamReader"/>.
/// </returns>
IStreamReader Create(string path,
Encoding encoding,
bool detectEncodingFromByteOrderMarks,
int bufferSize);
#endregion
}
}

Просмотреть файл

@ -10,7 +10,7 @@ namespace SystemInterface.IO
/// Wrapper for <see cref="T:System.IO.StreamWriter"/> class.
/// </summary>
[CLSCompliant(false)]
public interface IStreamWriter
public interface IStreamWriter : IDisposable
{
/// <summary>

Просмотреть файл

@ -0,0 +1,332 @@
namespace SystemInterface.Net
{
using System;
using System.Net;
using System.Security.Cryptography.X509Certificates;
using SystemInterface.IO;
public interface IHttpWebRequest
{
#region Public Properties
/// <summary>
/// Gets or sets the value of the Accept header.
/// </summary>
string Accept { get; set; }
/// <summary>
/// Gets the Uri that actually responded to the request.
/// </summary>
Uri Address { get; }
/// <summary>
/// Enables or disables automatically following redirection responses.
/// </summary>
bool AllowAutoRedirect { get; set; }
/// <summary>
/// Enables or disables buffering the data stream sent to the server.
/// </summary>
bool AllowWriteStreamBuffering { get; set; }
// de WebRequest...
//AuthenticationLevel AuthenticationLevel { get; set; }
DecompressionMethods AutomaticDecompression { get; set; }
/// <summary>
/// ClientCertificates - sets our certs for our reqest,
/// uses a hash of the collection to create a private connection
/// group, to prevent us from using the same Connection as
/// non-Client Authenticated requests.
/// </summary>
X509CertificateCollection ClientCertificates { get; set; }
/// <summary>
/// Gets and sets the value of the Connection header. Setting null clears the header out.
/// </summary>
string Connection { get; set; }
/// <summary>
/// ConnectionGroupName - used to control which group
/// of connections we use, by default should be null
/// </summary>
string ConnectionGroupName { get; set; }
/// <summary>
/// Gets or sets the Content-Length header of the request.
/// </summary>
long ContentLength { get; set; }
/// <summary>
/// Gets and sets the value of the Content-Type header. Null clears it out.
/// </summary>
string ContentType { get; set; }
/// <summary>
/// Gets/Sets Deletegate used to signal us on Continue callback.
/// </summary>
HttpContinueDelegate ContinueDelegate { get; set; }
CookieContainer CookieContainer { get; set; }
/// <summary>
/// Provides authentication information for the request.
/// </summary>
ICredentials Credentials { get; set; }
/// <summary>
/// Gets or sets the value of the Date header.
/// </summary>
DateTime Date { get; set; }
/// <summary>
/// Gets or sets the value of the Expect header.
/// </summary>
string Expect { get; set; }
/// <summary>
/// Returns <see langword='true'/> if a response has been received from the
/// server.
/// </summary>
bool HaveResponse { get; }
/// <summary>
/// A collection of HTTP headers stored as name value pairs.
/// </summary>
WebHeaderCollection Headers { get; set; }
string Host { get; set; }
/// <summary>
/// Gets or sets the value of the If-Modified-Since header.
/// </summary>
DateTime IfModifiedSince { get; set; }
/// <summary>
/// Gets or sets the value of the Keep-Alive header.
/// </summary>
bool KeepAlive { get; set; }
int MaximumAutomaticRedirections { get; set; }
int MaximumResponseHeadersLength { get; set; }
/// <summary>
/// Gets or sets the media type header.
/// </summary>
string MediaType { get; set; }
/// <summary>
/// Gets or sets the request method.
/// This method represents the initial origin Verb, this is unchanged/uneffected by redirects
/// </summary>
string Method { get; set; }
/// <summary>
/// Gets or sets the value of Pipelined property.
/// </summary>
bool Pipelined { get; set; }
/// <summary>
/// Enables or disables pre-authentication.
/// </summary>
bool PreAuthenticate { get; set; }
/// <summary>
/// Gets and sets the HTTP protocol version used in this request.
/// </summary>
Version ProtocolVersion { get; set; }
/// <summary>
/// Gets or sets the proxy information for a request.
/// </summary>
IWebProxy Proxy { get; set; }
/// <summary>
/// Used to control the Timeout when calling Stream.Read (AND) Stream.Write.
/// Effects Streams returned from GetResponse().GetResponseStream() (AND) GetRequestStream().
/// Default is 5 mins.
/// </summary>
int ReadWriteTimeout { get; set; }
/// <summary>
/// Gets or sets the value of the Referer header.
/// </summary>
string Referer { get; set; }
/// <summary>
/// Gets the original Uri of the request.
/// This read-only propery returns the Uri for this request. The
/// Uri object was created by the constructor and is always non-null.
///
/// Note that it will always be the base Uri, and any redirects,
/// or such will not be indicated.
/// </summary>
Uri RequestUri { get; }
/// <summary>
/// Enable and disable sending chunked data to the server.
/// </summary>
bool SendChunked { get; set; }
/// <summary>
/// Gets the service point used for this request. Looks up the ServicePoint for given Uri,
/// one isn't already created and assigned to this HttpWebRequest.
/// </summary>
ServicePoint ServicePoint { get; }
/// <summary>
/// Timeout is set to 100 seconds by default.
/// </summary>
int Timeout { get; set; }
/// <summary>
/// Gets or sets the value of the Transfer-Encoding header. Setting null clears it out.
/// </summary>
string TransferEncoding { get; set; }
/// <summary>
/// Allows hi-speed NTLM connection sharing with keep-alive
/// </summary>
bool UnsafeAuthenticatedConnectionSharing { get; set; }
/// <summary>
/// Allows us to use generic default credentials.
/// </summary>
bool UseDefaultCredentials { get; set; }
/// <summary>
///
/// </summary>
string UserAgent { get; set; }
#endregion
#region Public Methods and Operators
/// <summary>
/// Adds a range header to the request for a specified range.
/// </summary>
/// <param name="from"></param>
/// <param name="to"></param>
void AddRange(int from,
int to);
/// <summary>
/// Adds a range header to the request for a specified range.
/// </summary>
/// <param name="from"></param>
/// <param name="to"></param>
void AddRange(long from,
long to);
/// <summary>
/// Adds a range header to a request for a specific
/// range from the beginning or end
/// of the requested data.
/// To add the range from the end pass negative value
/// To add the range from the some offset to the end pass positive value
/// </summary>
/// <param name="range"></param>
void AddRange(int range);
/// <summary>
/// Adds a range header to a request for a specific
/// range from the beginning or end
/// of the requested data.
/// To add the range from the end pass negative value
/// To add the range from the some offset to the end pass positive value
/// </summary>
/// <param name="range"></param>
void AddRange(long range);
void AddRange(string rangeSpecifier,
int from,
int to);
void AddRange(string rangeSpecifier,
long from,
long to);
void AddRange(string rangeSpecifier,
int range);
void AddRange(string rangeSpecifier,
long range);
/// <summary>
/// Retreives the Request Stream from an HTTP Request uses an Async
/// operation to do this, and the result is retrived async.
///
/// Async operations include work in progess, this call is used to retrieve
/// results by pushing the async operations to async worker thread on the callback.
/// There are many open issues involved here including the handling of possible blocking
/// within the bounds of the async worker thread or the case of Write and Read stream
/// operations still blocking.
/// </summary>
/// <param name="callback"></param>
/// <param name="state"></param>
/// <returns></returns>
IAsyncResult BeginGetRequestStream(AsyncCallback callback,
object state);
/// <summary>
/// Used to query for the Response of an HTTP Request using Async
/// </summary>
/// <param name="callback"></param>
/// <param name="state"></param>
/// <returns></returns>
IAsyncResult BeginGetResponse(AsyncCallback callback,
object state);
IStream EndGetRequestStream(IAsyncResult asyncResult);
/// <summary>
/// Retreives the Request Stream after an Async operation has completed.
/// </summary>
/// <param name="asyncResult"></param>
/// <param name="context"></param>
/// <returns></returns>
IStream EndGetRequestStream(IAsyncResult asyncResult,
out TransportContext context);
/// <summary>
/// Retreives the Response Result from an HTTP Result after an Async operation has completed.
/// </summary>
/// <param name="asyncResult"></param>
/// <returns></returns>
IHttpWebResponse EndGetResponse(IAsyncResult asyncResult);
IStream GetRequestStream();
/// <summary>
/// Gets a <see cref='System.IO.Stream'/> that the application can use to write request data.
/// This property returns a stream that the calling application can write on.
/// This property is not settable. Getting this property may cause the
/// request to be sent, if it wasn't already. Getting this property after
/// a request has been sent that doesn't have an entity body causes an
/// exception to be thrown.
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
IStream GetRequestStream(out TransportContext context);
/// <summary>
/// Returns a response from a request to an Internet resource.
/// The response property. This property returns the WebResponse for this
/// request. This may require that a request be submitted first.
///
/// The idea is that we look and see if a request has already been
/// submitted. If one has, we'll just return the existing response
/// (if it's not null). If we haven't submitted a request yet, we'll
/// do so now, possible multiple times while we handle redirects
/// etc.
/// </summary>
/// <returns></returns>
IHttpWebResponse GetResponse();
#endregion
}
}

Просмотреть файл

@ -0,0 +1,36 @@
namespace SystemInterface.Net
{
using System;
/// <summary>
/// Factory to create a new <see cref="IHttpWebRequest"/> instance.
/// </summary>
public interface IHttpWebRequestFactory
{
#region Public Methods and Operators
/// <summary>
/// Creates a new <see cref="IHttpWebRequest"/> instance passing an uri.
/// </summary>
/// <param name="requestUri">
/// The request uri.
/// </param>
/// <returns>
/// The <see cref="IHttpWebRequest"/>.
/// </returns>
IHttpWebRequest Create(Uri requestUri);
/// <summary>
/// Creates a new <see cref="IHttpWebRequest"/> instance passing a string uri.
/// </summary>
/// <param name="requestUriString">
/// The request uri string.
/// </param>
/// <returns>
/// The <see cref="IHttpWebRequest"/>.
/// </returns>
IHttpWebRequest Create(string requestUriString);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,98 @@
namespace SystemInterface.Net
{
using System;
using System.Net;
using SystemInterface.IO;
public interface IHttpWebResponse
{
#region Public Properties
string CharacterSet { get; }
/// <summary>
/// Gets the method used to encode the body of the response.
/// </summary>
String ContentEncoding { get; }
/// <summary>
/// Gets the lenght of the content returned by the request.
/// </summary>
long ContentLength { get; }
/// <summary>
/// Gets the content type of the response.
/// </summary>
string ContentType { get; }
CookieCollection Cookies { get; set; }
/// <summary>
/// Gets the headers associated with this response from the server.
/// </summary>
WebHeaderCollection Headers { get; }
bool IsMutuallyAuthenticated { get; }
/// <summary>
/// Gets the last date and time that the content of the response was modified.
/// </summary>
DateTime LastModified { get; }
/// <summary>
/// Gets the value of the method used to return the response.
/// </summary>
string Method { get; }
/// <summary>
/// Gets the version of the HTTP protocol used in the response.
/// </summary>
Version ProtocolVersion { get; }
/// <summary>
/// Gets the Uniform Resource Indentifier (Uri) of the resource that returned the response.
/// </summary>
Uri ResponseUri { get; }
/// <summary>
/// Gets the name of the server that sent the response.
/// </summary>
string Server { get; }
/// <summary>
/// Gets a number indicating the status of the response.
/// </summary>
HttpStatusCode StatusCode { get; }
/// <summary>
/// Gets the status description returned with the response.
/// </summary>
string StatusDescription { get; }
#endregion
#region Public Methods and Operators
/// <summary>
/// Closes the Response after the use.
/// This causes the read stream to be closed.
/// </summary>
void Close();
/// <summary>
/// Gets a specified header value returned with the response.
/// </summary>
/// <param name="headerName"></param>
/// <returns></returns>
string GetResponseHeader(string headerName);
/// <summary>
/// Gets the stream used for reading the body of the response from the server.
/// </summary>
/// <returns></returns>
IStream GetResponseStream();
#endregion
}
}

Просмотреть файл

@ -0,0 +1,21 @@
namespace SystemInterface.Net
{
using System.Net;
/// <summary>
/// Factory to create a new <see cref="IHttpWebResponse"/> instance.
/// </summary>
public interface IHttpWebResponseFactory
{
/// <summary>
/// Creates a new <see cref="IHttpWebResponse"/> instance passing a web response.
/// </summary>
/// <param name="webResponse">
/// The web response.
/// </param>
/// <returns>
/// The <see cref="IHttpWebResponse"/>.
/// </returns>
IHttpWebResponse Create(WebResponse webResponse);
}
}

Просмотреть файл

@ -0,0 +1,56 @@
namespace SystemInterface.Net.Mail
{
/// <summary>
/// Defines the contract for MailAdress class.
/// </summary>
public interface IMailAddress
{
#region Public Properties
/// <summary>
/// Gets the e-mail address specified when this instance was created.
/// </summary>
/// <returns>
/// A System.String that contains the e-mail address.
/// </returns>
string Address { get; }
/// <summary>
/// Gets the display name composed from the display name and address information specified when this instance was created.
/// </summary>
/// <returns>
/// A System.String that contains the display name; otherwise, System.String.Empty ("") if no display name information was specified when this instance was created.
/// </returns>
string DisplayName { get; }
/// <summary>
/// Gets the host portion of the address specified when this instance was created.
/// </summary>
/// <returns>
/// A System.String that contains the name of the host computer that accepts e-mail for the System.Net.Mail.MailAddress.User property.
/// </returns>
string Host { get; }
/// <summary>
/// Gets the user information from the address specified when this instance was created.
/// </summary>
/// <returns>
/// A System.String that contains the user name portion of the System.Net.Mail.MailAddress.Address.
/// </returns>
string User { get; }
#endregion
#region Public Methods and Operators
/// <summary>
/// Returns a string representation of this instance.
/// </summary>
/// <returns>
/// A System.String that contains the contents of this System.Net.Mail.MailAddress.
/// </returns>
string ToString();
#endregion
}
}

Просмотреть файл

@ -0,0 +1,40 @@
namespace SystemInterface.Net.Mail
{
using System;
using System.Collections.Generic;
/// <summary>
/// Defines the contract for MailAddressCollection class.
/// </summary>
public interface IMailAddressCollection : ICollection<IMailAddress>
{
#region Public Methods and Operators
/// <summary>
/// Add a list of e-mail addresses to the collection.
/// </summary>
/// <param name="address">
/// The e-mail addresses to add to the MailAddressCollection. Multiple e-mail addresses must be separated with a comma character (",").
/// </param>
/// <exception cref="ArgumentNullException">
/// The addresses parameter is null.
/// </exception>
/// <exception cref="ArgumentException">
/// The addresses parameter is an empty string.
/// </exception>
/// <exception cref="FormatException">
/// The addresses parameter contains an e-mail address that is invalid or not supported.
/// </exception>
void Add(string address);
/// <summary>
/// Returns a string representation of the e-mail addresses in this System.Net.Mail.MailAddressCollection object.
/// </summary>
/// <returns>
/// A System.String containing the e-mail addresses in this collection.
/// </returns>
string ToString();
#endregion
}
}

Просмотреть файл

@ -0,0 +1,78 @@
namespace SystemInterface.Net.Mail
{
using System;
using System.Text;
/// <summary>
/// Defines the contract for MailAdress class.
/// </summary>
public interface IMailAddressFactory
{
#region Public Methods and Operators
/// <summary>
/// Initializes a new instance of the System.Net.Mail.MailAddress class using the specified address.
/// </summary>
/// <param name="address">
/// A System.String that contains an e-mail address.
/// </param>
/// <exception cref="ArgumentNullException">
/// address is null.
/// </exception>
/// <exception cref="ArgumentException">
/// address is System.String.Empty ("").
/// </exception>
/// <exception cref="FormatException">
/// address is not in a recognized format.
/// </exception>
IMailAddress Create(string address);
/// <summary>
/// Initializes a new instance of the System.Net.Mail.MailAddress class using the specified address, and display name.
/// </summary>
/// <param name="address">
/// A System.String that contains an e-mail address.
/// </param>
/// <param name="displayName">
/// A System.String that contains the display name associated with address.
/// </param>
/// <exception cref="ArgumentNullException">
/// address is null.
/// </exception>
/// <exception cref="ArgumentException">
/// address is System.String.Empty ("").
/// </exception>
/// <exception cref="FormatException">
/// address is not in a recognized format.-or-address contains non-ASCII characters.
/// </exception>
IMailAddress Create(string address,
string displayName);
/// <summary>
/// Initializes a new instance of the System.Net.Mail.MailAddress class using the specified address, display name, and encoding.
/// </summary>
/// <param name="address">
/// A System.String that contains an e-mail address.
/// </param>
/// <param name="displayName">
/// A System.String that contains the display name associated with address.
/// </param>
/// <param name="encoding">
/// The System.Text.Encoding that defines the character set used for displayName.
/// </param>
/// <exception cref="ArgumentNullException">
/// address is null.-or-displayName is null.
/// </exception>
/// <exception cref="ArgumentException">
/// address is System.String.Empty ("").-or-displayName is System.String.Empty ("").
/// </exception>
/// <exception cref="FormatException">
/// address is not in a recognized format.-or-address contains non-ASCII characters.
/// </exception>
IMailAddress Create(string address,
string displayName,
Encoding encoding);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,43 @@
namespace SystemInterface.Net.Mail
{
/// <summary>
/// Defines the contract for MailMessage class.
/// </summary>
public interface IMailMessage
{
#region Public Properties
/// <summary>
/// Gets the address collection that contains the blind carbon copy (BCC) recipients for this e-mail message.
/// </summary>
IMailAddressCollection Bcc { get; }
/// <summary>
/// Gets or sets the message body.
/// </summary>
string Body { get; set; }
/// <summary>
/// Gets the address collection that contains the carbon copy (CC) recipients for this e-mail message.
/// </summary>
// ReSharper disable once InconsistentNaming
IMailAddressCollection CC { get; }
/// <summary>
/// Gets or sets the from address for this e-mail message.
/// </summary>
IMailAddress From { get; set; }
/// <summary>
/// Gets or sets the subject line for this e-mail message.
/// </summary>
string Subject { get; set; }
/// <summary>
/// Gets the address collection that contains the recipients of this e-mail message.
/// </summary>
IMailAddressCollection To { get; }
#endregion
}
}

Просмотреть файл

@ -0,0 +1,44 @@
namespace SystemInterface.Net.Mail
{
using System;
using System.Net.Mail;
/// <summary>
/// Defines the contract for SmtpClient class.
/// </summary>
public interface ISmtpClient
{
#region Public Properties
/// <summary>
/// Gets or sets the name or IP address of the host used for SMTP transactions.
/// </summary>
string Host { get; set; }
#endregion
#region Public Methods and Operators
/// <summary>
/// Sends the specified message to an SMTP server for delivery.
/// </summary>
/// <param name="mailMessage">
/// A System.Net.Mail.MailMessage that contains the message to send.
/// </param>
/// <exception cref="InvalidOperationException">
/// This System.Net.Mail.SmtpClient has a Overload:System.Net.Mail.SmtpClient.SendAsync call in progress.-or- System.Net.Mail.MailMessage.From is null.-or- There are no recipients specified in System.Net.Mail.MailMessage.To, System.Net.Mail.MailMessage.CC, and System.Net.Mail.MailMessage.Bcc properties.-or- System.Net.Mail.SmtpClient.DeliveryMethod property is set to System.Net.Mail.SmtpDeliveryMethod.Network and System.Net.Mail.SmtpClient.Host is null.-or-System.Net.Mail.SmtpClient.DeliveryMethod property is set to System.Net.Mail.SmtpDeliveryMethod.Network and System.Net.Mail.SmtpClient.Host is equal to the empty string ("").-or- System.Net.Mail.SmtpClient.DeliveryMethod property is set to System.Net.Mail.SmtpDeliveryMethod.Network and System.Net.Mail.SmtpClient.Port is zero, a negative number, or greater than 65,535.
/// </exception>
/// <exception cref="ObjectDisposedException">
/// This object has been disposed.
/// </exception>
/// <exception cref="SmtpException">
/// The connection to the SMTP server failed.-or-Authentication failed.-or-The operation timed out.-or-System.Net.Mail.SmtpClient.EnableSsl is set to true but the System.Net.Mail.SmtpClient.DeliveryMethod property is set to System.Net.Mail.SmtpDeliveryMethod.SpecifiedPickupDirectory or System.Net.Mail.SmtpDeliveryMethod.PickupDirectoryFromIis.-or-System.Net.Mail.SmtpClient.EnableSsl is set to true, but the SMTP mail server did not advertise STARTTLS in the response to the EHLO command.
/// </exception>
/// /// <exception cref="SmtpFailedRecipientsException">
/// The message could not be delivered to one or more of the recipients in System.Net.Mail.MailMessage.To, System.Net.Mail.MailMessage.CC, or System.Net.Mail.MailMessage.Bcc.
/// </exception>
void Send(IMailMessage mailMessage);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,310 @@
namespace SystemInterface.Runtime.Serialization.Json
{
using System;
using System.Collections.ObjectModel;
using System.IO;
using System.Runtime.Serialization;
using System.Xml;
/// <summary>
/// Wrapper for <see cref="T:System.Runtime.Serialization.Json.DataContractJsonSerializer"/> class.
/// </summary>
public interface IDataContractJsonSerializer
{
#region Public Properties
/// <summary>
/// Gets a surrogate type that is currently active for a given <see cref="T:System.Runtime.Serialization.IDataContractSurrogate"/> instance.
/// Surrogates can extend the serialization or deserialization process.
/// </summary>
IDataContractSurrogate DataContractSurrogate { get; }
/// <summary>
/// Gets a value that specifies whether unknown data is ignored on deserialization and whether the
/// <see cref="T:System.Runtime.Serialization.IExtensibleDataObject"/> interface is ignored on serialization.
/// </summary>
/// <returns>
/// true to ignore unknown data and <see cref="T:System.Runtime.Serialization.IExtensibleDataObject"/>; otherwise, false.
/// </returns>
bool IgnoreExtensionDataObject { get; }
/// <summary>
/// Gets a collection of types that may be present in the object graph serialized using this instance of the
/// <see cref="T:System.Runtime.Serialization.Json.DataContractJsonSerializer"/>.
/// </summary>
/// <returns>
/// A <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1"/> that contains the expected types passed in as known types to
/// the <see cref="T:System.Runtime.Serialization.Json.DataContractJsonSerializer"/> constructor.
/// </returns>
ReadOnlyCollection<Type> KnownTypes { get; }
/// <summary>
/// Gets the maximum number of items in an object graph that the serializer serializes or deserializes in one read or write call.
/// </summary>
/// <returns>
/// The maximum number of items to serialize or deserialize.
/// </returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// The number of items exceeds the maximum value.
/// </exception>
int MaxItemsInObjectGraph { get; }
#endregion
#region Public Methods and Operators
/// <summary>
/// Determines whether the <see cref="T:System.Xml.XmlReader"/> is positioned on an object that can be deserialized.
/// </summary>
/// <param name="reader">
/// The <see cref="T:System.Xml.XmlReader"/> used to read the XML stream.
/// </param>
/// <returns>
/// true if the reader is positioned correctly; otherwise, false.
/// </returns>
bool IsStartObject(XmlReader reader);
/// <summary>
/// Gets a value that specifies whether the <see cref="T:System.Xml.XmlDictionaryReader"/> is positioned over an XML element that represents
/// an object the serializer can deserialize from.
/// </summary>
/// <param name="reader">
/// The <see cref="T:System.Xml.XmlDictionaryReader"/> used to read the XML stream mapped from JSON.
/// </param>
/// <returns>
/// true if the reader is positioned correctly; otherwise, false.
/// </returns>
bool IsStartObject(XmlDictionaryReader reader);
/// <summary>
/// Reads a document stream in the JSON (JavaScript Object Notation) format and returns the deserialized object.
/// </summary>
/// <param name="stream">
/// The <see cref="T:System.IO.Stream"/> to be read.
/// </param>
/// <returns>
/// The deserialized object.
/// </returns>
object ReadObject(Stream stream);
/// <summary>
/// Reads the XML document mapped from JSON (JavaScript Object Notation) with an <see cref="T:System.Xml.XmlReader"/> and returns the
/// deserialized object.
/// </summary>
/// <param name="reader">
/// An <see cref="T:System.Xml.XmlReader"/> used to read the XML document mapped from JSON.
/// </param>
/// <returns>
/// The deserialized object.
/// </returns>
object ReadObject(XmlReader reader);
/// <summary>
/// Reads an XML document mapped from JSON with an <see cref="T:System.Xml.XmlReader"/> and returns the deserialized object; it also enables
/// you to specify whether the serializer should verify that it is positioned on an appropriate element before attempting to deserialize.
/// </summary>
/// <param name="reader">
/// An <see cref="T:System.Xml.XmlReader"/> used to read the XML document mapped from JSON.
/// </param>
/// <param name="verifyObjectName">
/// true to check whether the enclosing XML element name and namespace correspond to the expected name and namespace; otherwise, false,
/// which skips the verification. The default is true.
/// </param>
/// <returns>
/// The deserialized object.
/// </returns>
object ReadObject(XmlReader reader,
bool verifyObjectName);
/// <summary>
/// Reads the XML document mapped from JSON (JavaScript Object Notation) with an <see cref="T:System.Xml.XmlDictionaryReader"/> and returns
/// the deserialized object.
/// </summary>
/// <param name="reader">
/// An <see cref="T:System.Xml.XmlDictionaryReader"/> used to read the XML document mapped from JSON.
/// </param>
/// <returns>
/// The deserialized object.
/// </returns>
object ReadObject(XmlDictionaryReader reader);
/// <summary>
/// Reads the XML document mapped from JSON with an <see cref="T:System.Xml.XmlDictionaryReader"/> and returns the deserialized object; it
/// also enables you to specify whether the serializer should verify that it is positioned on an appropriate element before attempting to
/// deserialize.
/// </summary>
/// <param name="reader">
/// An <see cref="T:System.Xml.XmlDictionaryReader"/> used to read the XML document mapped from JSON.
/// </param>
/// <param name="verifyObjectName">
/// true to check whether the enclosing XML element name and namespace correspond to the expected name and namespace; otherwise, false to skip the
/// verification. The default is true.
/// </param>
/// <returns>
/// The deserialized object.
/// </returns>
object ReadObject(XmlDictionaryReader reader,
bool verifyObjectName);
/// <summary>
/// Writes the closing XML element to an XML document, using an <see cref="T:System.Xml.XmlWriter"/>, which can be mapped to JavaScript Object
/// Notation (JSON).
/// </summary>
/// <param name="writer">
/// An <see cref="T:System.Xml.XmlWriter"/> used to write the XML document mapped to JSON.
/// </param>
void WriteEndObject(XmlWriter writer);
/// <summary>
/// Writes the closing XML element to an XML document, using an <see cref="T:System.Xml.XmlDictionaryWriter"/>, which can be mapped to
/// JavaScript Object Notation (JSON).
/// </summary>
/// <param name="writer">
/// An <see cref="T:System.Xml.XmlDictionaryWriter"/> used to write the XML document to map to JSON.
/// </param>
void WriteEndObject(XmlDictionaryWriter writer);
/// <summary>
/// Serializes a specified object to JavaScript Object Notation (JSON) data and writes the resulting JSON to a stream.
/// </summary>
/// <param name="stream">
/// The <see cref="T:System.IO.Stream"/> that is written to.
/// </param>
/// <param name="graph">
/// The object that contains the data to write to the stream.
/// </param>
/// <exception cref="T:System.Runtime.Serialization.InvalidDataContractException">
/// The type being serialized does not conform to data contract rules. For example, the
/// <see cref="T:System.Runtime.Serialization.DataContractAttribute"/> attribute has not been applied to the type.
/// </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">
/// There is a problem with the instance being written.
/// </exception>
/// <exception cref="T:System.ServiceModel.QuotaExceededException">
/// The maximum number of objects to serialize has been exceeded. Check the
/// <see cref="P:System.Runtime.Serialization.DataContractSerializer.MaxItemsInObjectGraph"/> property.
/// </exception>
void WriteObject(Stream stream,
object graph);
/// <summary>
/// Serializes an object to XML that may be mapped to JavaScript Object Notation (JSON). Writes all the object data, including the starting XML
/// element, content, and closing element, with an <see cref="T:System.Xml.XmlWriter"/>.
/// </summary>
/// <param name="writer">
/// The <see cref="T:System.Xml.XmlWriter"/> used to write the XML document to map to JSON.
/// </param>
/// <param name="graph">
/// The object that contains the data to write.
/// </param>
/// <exception cref="T:System.Runtime.Serialization.InvalidDataContractException">
/// The type being serialized does not conform to data contract rules. For example, the
/// <see cref="T:System.Runtime.Serialization.DataContractAttribute"/> attribute has not been applied to the type.
/// </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">
/// There is a problem with the instance being written.
/// </exception>
/// <exception cref="T:System.ServiceModel.QuotaExceededException">
/// The maximum number of objects to serialize has been exceeded. Check the
/// <see cref="P:System.Runtime.Serialization.DataContractSerializer.MaxItemsInObjectGraph"/> property.
/// </exception>
void WriteObject(XmlWriter writer,
object graph);
/// <summary>
/// Serializes an object to XML that may be mapped to JavaScript Object Notation (JSON). Writes all the object data, including the starting XML
/// element, content, and closing element, with an <see cref="T:System.Xml.XmlDictionaryWriter"/>.
/// </summary>
/// <param name="writer">
/// The <see cref="T:System.Xml.XmlDictionaryWriter"/> used to write the XML document or stream to map to JSON.
/// </param>
/// <param name="graph">
/// The object that contains the data to write.
/// </param>
/// <exception cref="T:System.Runtime.Serialization.InvalidDataContractException">
/// The type being serialized does not conform to data contract rules. For example, the
/// <see cref="T:System.Runtime.Serialization.DataContractAttribute"/> attribute has not been applied to the type.
/// </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">
/// There is a problem with the instance being written.
/// </exception>
/// <exception cref="T:System.ServiceModel.QuotaExceededException">
/// The maximum number of objects to serialize has been exceeded. Check the
/// <see cref="P:System.Runtime.Serialization.DataContractSerializer.MaxItemsInObjectGraph"/> property.
/// </exception>
void WriteObject(XmlDictionaryWriter writer,
object graph);
/// <summary>
/// Writes the XML content that can be mapped to JavaScript Object Notation (JSON) using an <see cref="T:System.Xml.XmlWriter"/>.
/// </summary>
/// <param name="writer">
/// The <see cref="T:System.Xml.XmlWriter"/> used to write to.
/// </param>
/// <param name="graph">
/// The object to write.
/// </param>
/// <exception cref="T:System.Runtime.Serialization.InvalidDataContractException">
/// The type being serialized does not conform to data contract rules. For example, the
/// <see cref="T:System.Runtime.Serialization.DataContractAttribute"/> attribute has not been applied to the type.
/// </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">
/// There is a problem with the instance being written.
/// </exception>
/// <exception cref="T:System.ServiceModel.QuotaExceededException">
/// The maximum number of objects to serialize has been exceeded. Check the
/// <see cref="P:System.Runtime.Serialization.DataContractSerializer.MaxItemsInObjectGraph"/> property.
/// </exception>
void WriteObjectContent(XmlWriter writer,
object graph);
/// <summary>
/// Writes the XML content that can be mapped to JavaScript Object Notation (JSON) using an <see cref="T:System.Xml.XmlDictionaryWriter"/>.
/// </summary>
/// <param name="writer">
/// The <see cref="T:System.Xml.XmlDictionaryWriter"/> to write to.
/// </param>
/// <param name="graph">
/// The object to write.</param><exception cref="T:System.Runtime.Serialization.InvalidDataContractException">The type being serialized does
/// not conform to data contract rules. For example, the <see cref="T:System.Runtime.Serialization.DataContractAttribute"/> attribute has not
/// been applied to the type.
/// </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">
/// There is a problem with the instance being written.
/// </exception>
/// <exception cref="T:System.ServiceModel.QuotaExceededException">
/// The maximum number of objects to serialize has been exceeded. Check the
/// <see cref="P:System.Runtime.Serialization.DataContractSerializer.MaxItemsInObjectGraph"/> property.
/// </exception>
void WriteObjectContent(XmlDictionaryWriter writer,
object graph);
/// <summary>
/// Writes the opening XML element for serializing an object to XML that can be mapped to JavaScript Object Notation (JSON) using an
/// <see cref="T:System.Xml.XmlWriter"/>.
/// </summary>
/// <param name="writer">
/// The <see cref="T:System.Xml.XmlWriter"/> used to write the XML start element.
/// </param>
/// <param name="graph">
/// The object to write.
/// </param>
void WriteStartObject(XmlWriter writer,
object graph);
/// <summary>
/// Writes the opening XML element for serializing an object to XML that can be mapped to JavaScript Object Notation (JSON) using an
/// <see cref="T:System.Xml.XmlDictionaryWriter"/>.
/// </summary>
/// <param name="writer">
/// The <see cref="T:System.Xml.XmlDictionaryWriter"/> used to write the XML start element.
/// </param>
/// <param name="graph">
/// The object to write.
/// </param>
void WriteStartObject(XmlDictionaryWriter writer,
object graph);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,214 @@
namespace SystemInterface.Runtime.Serialization.Json
{
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Xml;
/// <summary>
/// Factory to create a new <see cref="IDataContractJsonSerializer"/> instance.
/// </summary>
public interface IDataContractJSonSerializerFactory
{
#region Public Methods and Operators
/// <summary>
/// Initializes a new instance of the <see cref="T:System.Runtime.Serialization.Json.DataContractJsonSerializer"/> class to serialize or
/// deserialize an object of the specified type.
/// </summary>
/// <param name="type">
/// The type of the instances that is serialized or deserialized.
/// </param>
IDataContractJsonSerializer Create(Type type);
/// <summary>
/// Initializes a new instance of the <see cref="T:System.Runtime.Serialization.Json.DataContractJsonSerializer"/> class to serialize or
/// deserialize an object of a specified type using the XML root element specified by a parameter.
/// </summary>
/// <param name="type">
/// The type of the instances that is serialized or deserialized.
/// </param>
/// <param name="rootName">
/// The name of the XML element that encloses the content to serialize or deserialize.
/// </param>
IDataContractJsonSerializer Create(Type type,
string rootName);
/// <summary>
/// Initializes a new instance of the <see cref="T:System.Runtime.Serialization.Json.DataContractJsonSerializer"/> class to serialize or
/// deserialize an object of a specified type using the XML root element specified by a parameter of type
/// <see cref="T:System.Xml.XmlDictionaryString"/>.
/// </summary>
/// <param name="type">
/// The type of the instances that is serialized or deserialized.
/// </param>
/// <param name="rootName">
/// An <see cref="T:System.Xml.XmlDictionaryString"/> that contains the root element name of the content.
/// </param>
IDataContractJsonSerializer Create(Type type,
XmlDictionaryString rootName);
/// <summary>
/// Initializes a new instance of the <see cref="T:System.Runtime.Serialization.Json.DataContractJsonSerializer"/> class to serialize or
/// deserialize an object of the specified type, with a collection of known types that may be present in the object graph.
/// </summary>
/// <param name="type">
/// The type of the instances that are serialized or deserialized.
/// </param>
/// <param name="knownTypes">
/// An <see cref="T:System.Collections.Generic.IEnumerable`1"/> of <see cref="T:System.Type"/> that contains the types that may be present
/// in the object graph.
/// </param>
IDataContractJsonSerializer Create(Type type,
IEnumerable<Type> knownTypes);
/// <summary>
/// Initializes a new instance of the <see cref="T:System.Runtime.Serialization.Json.DataContractJsonSerializer"/> class to serialize or
/// deserialize an object of a specified type using the XML root element specified by a parameter, with a collection of known types that may
/// be present in the object graph.
/// </summary>
/// <param name="type">
/// The type of the instances that is serialized or deserialized.
/// </param>
/// <param name="rootName">
/// The name of the XML element that encloses the content to serialize or deserialize. The default is "root".
/// </param>
/// <param name="knownTypes">
/// An <see cref="T:System.Collections.Generic.IEnumerable`1"/> of <see cref="T:System.Type"/> that contains the types that may be present in
/// the object graph.
/// </param>
IDataContractJsonSerializer Create(Type type,
string rootName,
IEnumerable<Type> knownTypes);
/// <summary>
/// Initializes a new instance of the <see cref="T:System.Runtime.Serialization.Json.DataContractJsonSerializer"/> class to serialize or
/// deserialize an object of a specified type using the XML root element specified by a parameter of type
/// <see cref="T:System.Xml.XmlDictionaryString"/>, with a collection of known types that may be present in the object graph.
/// </summary>
/// <param name="type">
/// The type of the instances that is serialized or deserialized.
/// </param>
/// <param name="rootName">
/// An <see cref="T:System.Xml.XmlDictionaryString"/> that contains the root element name of the content.
/// </param>
/// <param name="knownTypes">
/// An <see cref="T:System.Collections.Generic.IEnumerable`1"/> of <see cref="T:System.Type"/> that contains the types that may be present in
/// the object graph.
/// </param>
IDataContractJsonSerializer Create(Type type,
XmlDictionaryString rootName,
IEnumerable<Type> knownTypes);
/// <summary>
/// Initializes a new instance of the <see cref="T:System.Runtime.Serialization.Json.DataContractJsonSerializer"/> class to serialize or
/// deserialize an object of the specified type. This method also specifies a list of known types that may be present in the object graph,
/// the maximum number of graph items to serialize or deserialize, whether to ignore unexpected data or emit type information, and a surrogate
/// for custom serialization.
/// </summary>
/// <param name="type">
/// The type of the instances that is serialized or deserialized.
/// </param>
/// <param name="knownTypes">
/// An <see cref="T:System.Xml.XmlDictionaryString"/> that contains the root element name of the content.
/// </param>
/// <param name="maxItemsInObjectGraph">
/// An <see cref="T:System.Collections.Generic.IEnumerable`1"/> of <see cref="T:System.Type"/> that contains the types that may be present in
/// the object graph.
/// </param>
/// <param name="ignoreExtensionDataObject">
/// true to ignore the <see cref="T:System.Runtime.Serialization.IExtensibleDataObject"/> interface upon serialization and ignore unexpected
/// data upon deserialization; otherwise, false. The default is false.
/// </param>
/// <param name="dataContractSurrogate">
/// An implementation of the <see cref="T:System.Runtime.Serialization.IDataContractSurrogate"/> to customize the serialization process.
/// </param>
/// <param name="alwaysEmitTypeInformation">
/// true to emit type information; otherwise, false. The default is false.
/// </param>
IDataContractJsonSerializer Create(Type type,
IEnumerable<Type> knownTypes,
int maxItemsInObjectGraph,
bool ignoreExtensionDataObject,
IDataContractSurrogate dataContractSurrogate,
bool alwaysEmitTypeInformation);
/// <summary>
/// Initializes a new instance of the <see cref="T:System.Runtime.Serialization.Json.DataContractJsonSerializer"/> class to serialize or
/// deserialize an object of the specified type. This method also specifies the root name of the XML element, a list of known types that may
/// be present in the object graph, the maximum number of graph items to serialize or deserialize, whether to ignore unexpected data or emit
/// type information, and a surrogate for custom serialization.
/// </summary>
/// <param name="type">
/// The type of the instances that is serialized or deserialized.
/// </param>
/// <param name="rootName">
/// The name of the XML element that encloses the content to serialize or deserialize. The default is "root".
/// </param>
/// <param name="knownTypes">
/// An <see cref="T:System.Collections.Generic.IEnumerable`1"/> of <see cref="T:System.Type"/> that contains the types that may be present in
/// the object graph.
/// </param>
/// <param name="maxItemsInObjectGraph">
/// The maximum number of items in the graph to serialize or deserialize. The default is the value returned by the
/// <see cref="F:System.Int32.MaxValue"/> property.
/// </param>
/// <param name="ignoreExtensionDataObject">
/// true to ignore the <see cref="T:System.Runtime.Serialization.IExtensibleDataObject"/> interface upon serialization and ignore unexpected
/// data upon deserialization; otherwise, false. The default is false.
/// </param>
/// <param name="dataContractSurrogate">
/// An implementation of the <see cref="T:System.Runtime.Serialization.IDataContractSurrogate"/> to customize the serialization process.
/// </param>
/// <param name="alwaysEmitTypeInformation">
/// true to emit type information; otherwise, false. The default is false.
/// </param>
IDataContractJsonSerializer Create(Type type,
string rootName,
IEnumerable<Type> knownTypes,
int maxItemsInObjectGraph,
bool ignoreExtensionDataObject,
IDataContractSurrogate dataContractSurrogate,
bool alwaysEmitTypeInformation);
/// <summary>
/// Initializes a new instance of the <see cref="T:System.Runtime.Serialization.Json.DataContractJsonSerializer"/> class to serialize or
/// deserialize an object of the specified type. This method also specifies the root name of the XML element, a list of known types that may
/// be present in the object graph, the maximum number of graph items to serialize or deserialize, whether to ignore unexpected data or emit
/// type information, and a surrogate for custom serialization.
/// </summary>
/// <param name="type">
/// The type of the instances that are serialized or deserialized.
/// </param>
/// <param name="rootName">
/// An <see cref="T:System.Xml.XmlDictionaryString"/> that contains the root element name of the content.
/// </param>
/// <param name="knownTypes">
/// An <see cref="T:System.Collections.Generic.IEnumerable`1"/> of <see cref="T:System.Type"/> that contains the known types that may be present
/// in the object graph.
/// </param>
/// <param name="maxItemsInObjectGraph">
/// The maximum number of items in the graph to serialize or deserialize. The default is the value returned by the
/// <see cref="F:System.Int32.MaxValue"/> property.
/// </param>
/// <param name="ignoreExtensionDataObject">
/// true to ignore the <see cref="T:System.Runtime.Serialization.IExtensibleDataObject"/> interface upon serialization and ignore unexpected
/// data upon deserialization; otherwise, false. The default is false.
/// </param>
/// <param name="dataContractSurrogate">
/// An implementation of the <see cref="T:System.Runtime.Serialization.IDataContractSurrogate"/> to customize the serialization process.
/// </param>
/// <param name="alwaysEmitTypeInformation">
/// true to emit type information; otherwise, false. The default is false.
/// </param>
IDataContractJsonSerializer Create(Type type,
XmlDictionaryString rootName,
IEnumerable<Type> knownTypes,
int maxItemsInObjectGraph,
bool ignoreExtensionDataObject,
IDataContractSurrogate dataContractSurrogate,
bool alwaysEmitTypeInformation);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,9 @@
namespace SystemInterface.Security.Certificate
{
/// <summary>
/// Wrapper for <see cref="T:System.Security.Cryptography.Xml.KeyInfoX509Data"/> class.
/// </summary>
public interface IKeyInfoX509Data
{
}
}

Просмотреть файл

@ -0,0 +1,36 @@
namespace SystemInterface.Security.Certificate
{
using System.Security.Cryptography.X509Certificates;
/// <summary>
/// Interface of the KeyInfoX509Data factory.
/// </summary>
public interface IKeyInfoX509DataFactory
{
#region Public Methods and Operators
/// <summary>
/// BuildTrustedChainFromEndCertificate a KeyInfoX509Data object.
/// </summary>
/// <param name="certificate">
/// The certificate to create a KeyInfoX509Data object from.
/// </param>
/// <returns>
/// KeyInfoX509Data object of the given certificate.
/// </returns>
IKeyInfoX509Data Create(X509Certificate certificate);
/// <summary>
/// BuildTrustedChainFromEndCertificate a KeyInfoX509Data object.
/// </summary>
/// <param name="certificate">
/// The certificate to create a KeyInfoX509Data object from.
/// </param>
/// <returns>
/// KeyInfoX509Data object of the given certificate.
/// </returns>
IKeyInfoX509Data Create(IX509Certificate certificate);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,174 @@
namespace SystemInterface.Security.Certificate
{
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
/// <summary>
/// Interface wrapping a X509Certificate.
/// </summary>
public interface IX509Certificate
{
#region Public Properties
/// <summary>
/// Gets a collection of X509Extension objects.
/// </summary>
X509ExtensionCollection Extensions { get; }
/// <summary>
/// Gets a value indicating whether an IPamsCertificate object contains a private key.
/// </summary>
bool HasPrivateKey { get; }
/// <summary>
/// Gets the name of the certificate authority that issued the X509v3 certificate.
/// </summary>
string Issuer { get; }
/// <summary>
/// Gets the AsymmetricAlgorithm object that represents the private key associated with a certificate.
/// </summary>
AsymmetricAlgorithm PrivateKey { get; }
/// <summary>
/// Gets a PublicKey object associated with a certificate.
/// </summary>
PublicKey PublicKey { get; }
/// <summary>
/// Gets the subject distinguished name from the certificate.
/// </summary>
string Subject { get; }
#endregion
#region Public Methods and Operators
/// <summary>
/// Gets the SHA1 hash value for the X.509v3 certificate.
/// </summary>
/// <returns>
/// The hexadecimal string representation of the X.509 certificate hash value.
/// </returns>
string GetCertHashString();
/// <summary>
/// Gets the <see cref="X509Certificate2"/> instance.
/// </summary>
/// <returns>
/// The <see cref="X509Certificate2"/>.
/// </returns>
X509Certificate2 GetCertificate();
/// <summary>
/// Gets the effective date of this X509v3 certificate.
/// </summary>
/// <returns>
/// The effective date for this X.509 certificate.
/// </returns>
string GetEffectiveDateString();
/// <summary>
/// Gets the expiration date of this X509v3 certificate.
/// </summary>
/// <returns>
/// The expiration date for this X.509 certificate.
/// </returns>
string GetExpirationDateString();
/// <summary>
/// Gets the key algorithm parameters for the X.509v3 certificate.
/// </summary>
/// <returns>
/// The key algorithm parameters for the X.509 certificate as a hexadecimal string.
/// </returns>
string GetKeyAlgorithmParametersString();
/// <summary>
/// Gets the raw data for the entire X.509v3 certificate.
/// </summary>
/// <returns>
/// Byte array containing the X.509 certificate data
/// </returns>
byte[] GetRawCertData();
/// <summary>
/// Gets the raw data for the entire X.509v3 certificate.
/// </summary>
/// <returns>
/// The X.509 certificate data as a hexadecimal string.
/// </returns>
string GetRawCertDataString();
/// <summary>
/// Gets the serial number of the X.509v3 certificate.
/// </summary>
/// <returns>
/// The serial number of the X.509 certificate as an array of bytes.
/// </returns>
byte[] GetSerialNumber();
/// <summary>
/// Gets the serial number of the X.509v3 certificate.
/// </summary>
/// <returns>
/// The serial number of the X.509 certificate as a hexadecimal string.
/// </returns>
string GetSerialNumberString();
/// <summary>
/// Initializes a new instance of the <see cref="X509Certificate"/> wrapped class.
/// </summary>
void Initialize();
/// <summary>
/// Initializes a new instance of the <see cref="X509Certificate"/> wrapped class.
/// </summary>
/// <param name="rawData">
/// Byte array containing the X.509 certificate data
/// </param>
void Initialize(byte[] rawData);
/// <summary>
/// Initializes a new instance of the <see cref="X509Certificate"/> wrapped class.
/// </summary>
/// <param name="rawData">
/// Byte array containing the X.509 certificate data
/// </param>
/// <param name="password">
/// The password required to access the X.509 certificate data.
/// </param>
void Initialize(byte[] rawData,
string password);
/// <summary>
/// Initializes a new instance of the <see cref="X509Certificate"/> wrapped class.
/// </summary>
/// <param name="fileName">
/// the file name of a X.509 certificate data
/// </param>
void Initialize(string fileName);
/// <summary>
/// Initializes a new instance of the <see cref="X509Certificate"/> wrapped class.
/// </summary>
/// <param name="fileName">
/// the file name of a X.509 certificate data
/// </param>
/// <param name="password">
/// The password required to access the X.509 certificate data.
/// </param>
void Initialize(string fileName,
string password);
/// <summary>
/// Initializes a new instance of the <see cref="X509Certificate"/> wrapped class.
/// </summary>
/// <param name="certificate">
/// The certificate.
/// </param>
void Initialize(X509Certificate certificate);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,33 @@
namespace SystemInterface.Security.Certificate
{
using System.Security.Cryptography.X509Certificates;
/// <summary>
/// Interface wrapping a X509Certificate2Collection.
/// </summary>
public interface IX509Certificate2Collection
{
#region Public Methods and Operators
/// <summary>
/// Adds a certificate to an X.509 certificate store.
/// </summary>
/// <param name="certificate">
/// The IPamsCertificate to add to the current X509CertificateCollection.
/// </param>
/// <returns>
/// The index into the current X509CertificateCollection at which the new IPamsCertificate was inserted.
/// </returns>
int Add(IX509Certificate certificate);
/// <summary>
/// Initializes a new instance of the <see cref="X509Certificate2Collection"/> class.
/// </summary>
/// <param name="collection">
/// The collection of certificates.
/// </param>
void Initialize(X509Certificate2Collection collection);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,33 @@
namespace SystemInterface.Security.Certificate
{
using System.Security.Cryptography.X509Certificates;
/// <summary>
/// This interface wraps the X509Chain creation in order to be mock-able.
/// </summary>
public interface IX509Certificate2CollectionFactory
{
#region Public Methods and Operators
/// <summary>
/// Wraps the X509Certificate2Collection creation method.
/// </summary>
/// <returns>
/// The <see cref="IX509Certificate2Collection"/>.
/// </returns>
IX509Certificate2Collection Create();
/// <summary>
/// Wraps the X509Certificate2Collection creation method.
/// </summary>
/// <param name="collection">
/// The collection of certificates
/// </param>
/// <returns>
/// The <see cref="IX509Certificate2Collection"/>.
/// </returns>
IX509Certificate2Collection Create(X509Certificate2Collection collection);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,29 @@
namespace SystemInterface.Security.Certificate
{
using System.Security.Cryptography.X509Certificates;
/// <summary>
/// This interface wraps the X509Certificate creation in order to be mock-able.
/// </summary>
public interface IX509CertificateFactory
{
#region Public Methods and Operators
/// <summary>
/// Wraps the X509Certificate creation method.
/// </summary>
/// <param name="rawData">
/// Byte array containing data from an X.509 certificate.
/// </param>
/// <param name="password">
/// The password needed to access private key. Can be null if the certificate specified as bytes does not require password decryption.
/// </param>
/// <returns>
/// The <see cref="IX509Certificate"/>.
/// </returns>
X509Certificate Create(byte[] rawData,
string password = null);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,37 @@
namespace SystemInterface.Security.Certificate
{
using System.Security.Cryptography.X509Certificates;
/// <summary>
/// This interface wraps the X509Certificate creation in order to be mock-able.
/// </summary>
public interface IX509CertificateFactoryWrap
{
#region Public Methods and Operators
/// <summary>
/// Wraps the X509Certificate creation method.
/// </summary>
/// <param name="rawData">
/// Byte array containing data from an X.509 certificate.
/// </param>
/// <param name="password">
/// The password needed to access private key. Can be null if the certificate specified as bytes does not require password decryption.
/// </param>
/// <returns>
/// The <see cref="IX509Certificate"/>.
/// </returns>
IX509Certificate Create(byte[] rawData,
string password = null);
/// <summary>
/// Wraps the X509Certificate creation method.
/// </summary>
/// <returns>
/// The <see cref="IX509Certificate"/>.
/// </returns>
IX509Certificate Create(X509Certificate certificate);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,49 @@
namespace SystemInterface.Security.Certificate
{
using System.Security.Cryptography.X509Certificates;
/// <summary>
/// Interface wrapping a X509Chain.
/// </summary>
public interface IX509Chain
{
#region Public Properties
/// <summary>
/// Gets a collection of IPamsX509ChainElement objects.
/// </summary>
IX509ChainElementCollection ChainElements { get; }
/// <summary>
/// Gets the X509ChainPolicy to use when building an X.509 certificate chain.
/// </summary>
X509ChainPolicy ChainPolicy { get; }
/// <summary>
/// Gets the status of each element in an X509Chain object.
/// </summary>
X509ChainStatus[] ChainStatus { get; }
#endregion
#region Public Methods and Operators
/// <summary>
/// The build.
/// </summary>
/// <param name="certificate">
/// The certificate.
/// </param>
/// <returns>
/// The <see cref="bool"/>.
/// </returns>
bool Build(IX509Certificate certificate);
/// <summary>
/// Initializes a new instance of the class.
/// </summary>
void Initialize();
#endregion
}
}

Просмотреть файл

@ -0,0 +1,24 @@
namespace SystemInterface.Security.Certificate
{
using System.Security.Cryptography.X509Certificates;
/// <summary>
/// Interface wrapping a X509ChainElement.
/// </summary>
public interface IX509ChainElement
{
#region Public Properties
/// <summary>
/// Gets the X.509 certificate at a particular chain element.
/// </summary>
IX509Certificate Certificate { get; }
/// <summary>
/// Gets the error status of the current X.509 certificate in a chain.
/// </summary>
X509ChainStatus[] ChainElementStatus { get; }
#endregion
}
}

Просмотреть файл

@ -0,0 +1,68 @@
namespace SystemInterface.Security.Certificate
{
using System;
using System.Collections;
using System.Security.Cryptography.X509Certificates;
/// <summary>
/// Interface wrapping a X509ChainElementCollection.
/// </summary>
public interface IX509ChainElementCollection
{
#region Public Properties
/// <summary>
/// Gets the number of elements contained in the <see cref="T:System.Collections.ICollection"/>.
/// </summary>
int Count { get; }
#endregion
#region Public Indexers
/// <summary>
/// Gets the IPamsX509ChainElement object at the specified index.
/// </summary>
/// <param name="index">
/// An integer value.
/// </param>
/// <returns>
/// The <see cref="IX509ChainElement"/>.
/// </returns>
IX509ChainElement this[int index] { get; }
#endregion
#region Public Methods and Operators
/// <summary>
/// Copies the elements of the <see cref="T:System.Collections.ICollection"/> to an <see cref="T:System.Array"/>, starting at a particular <see cref="T:System.Array"/> index.
/// </summary>
/// <param name="array">
/// The array.
/// </param>
/// <param name="index">
/// The index.
/// </param>
void CopyTo(Array array,
int index);
/// <summary>
/// Returns an enumerator that iterates through a collection.
/// </summary>
/// <returns>
/// The <see cref="IEnumerator"/>.
/// </returns>
IEnumerator GetEnumerator();
/// <summary>
/// Initializes a new instance of the <see cref="IX509ChainElementCollection"/> class.
/// </summary>
/// <param name="collection">
/// The collection.
/// </param>
void Initialize(X509ChainElementCollection collection);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,33 @@
namespace SystemInterface.Security.Certificate
{
using System.Security.Cryptography.X509Certificates;
/// <summary>
/// This interface wraps the X509ChainElementCollection creation in order to be mock-able.
/// </summary>
public interface IX509ChainElementCollectionFactory
{
#region Public Methods and Operators
/// <summary>
/// Wraps the X509ChainElementCollection creation method.
/// </summary>
/// <returns>
/// The <see cref="IX509ChainElementCollection"/>.
/// </returns>
IX509ChainElementCollection Create();
/// <summary>
/// Wraps the X509ChainElementCollection creation method.
/// </summary>
/// <param name="collection">
/// The collection of X509ChainElement objects.
/// </param>
/// <returns>
/// The <see cref="IX509ChainElementCollection"/>.
/// </returns>
IX509ChainElementCollection Create(X509ChainElementCollection collection);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,34 @@
namespace SystemInterface.Security.Certificate
{
/// <summary>
/// Interface wrapping a X509ChainElementEnumerator.
/// </summary>
public interface IX509ChainElementEnumerator
{
#region Public Properties
/// <summary>
/// Gets the current element in the collection.
/// </summary>
IX509ChainElement Current { get; }
#endregion
#region Public Methods and Operators
/// <summary>
/// Advances the enumerator to the next element of the collection.
/// </summary>
/// <returns>
/// true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.
/// </returns>
bool MoveNext();
/// <summary>
/// Sets the enumerator to its initial position, which is before the first element in the collection.
/// </summary>
void Reset();
#endregion
}
}

Просмотреть файл

@ -0,0 +1,33 @@
namespace SystemInterface.Security.Certificate
{
using System.Security.Cryptography.X509Certificates;
/// <summary>
/// This interface wraps the X509ChainElement creation in order to be mock-able.
/// </summary>
public interface IX509ChainElementFactory
{
#region Public Methods and Operators
/// <summary>
/// Wraps the X509ChainElement creation method.
/// </summary>
/// <returns>
/// The <see cref="IX509ChainElement"/>.
/// </returns>
IX509ChainElement Create();
/// <summary>
/// Wraps the X509ChainElement creation method.
/// </summary>
/// <param name="element">
/// The X.509v3 chain element.
/// </param>
/// <returns>
/// The <see cref="IX509ChainElement"/>.
/// </returns>
IX509ChainElement Create(X509ChainElement element);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,20 @@
namespace SystemInterface.Security.Certificate
{
/// <summary>
/// This interface wraps the X509Chain creation in order to be mock-able.
/// </summary>
public interface IX509ChainFactory
{
#region Public Methods and Operators
/// <summary>
/// Wraps the X509Chain creation method.
/// </summary>
/// <returns>
/// The <see cref="IX509Chain"/>.
/// </returns>
IX509Chain Create();
#endregion
}
}

Просмотреть файл

@ -0,0 +1,39 @@
namespace SystemInterface.Security.Certificate
{
using System.Security.Cryptography.X509Certificates;
/// <summary>
/// Interface wrapping a X509Store.
/// </summary>
public interface IX509Store
{
#region Public Properties
/// <summary>
/// Gets a collection of certificates.
/// </summary>
IX509Certificate2Collection Certificates { get; }
#endregion
#region Public Methods and Operators
/// <summary>
/// Initializes a new instance of the <see cref="X509Store"/> class.
/// </summary>
/// <param name="storeLocation">
/// One of the enumeration values that specifies the location of the X.509 certificate store.
/// </param>
void Initialize(StoreLocation storeLocation);
/// <summary>
/// Opens an X.509 certificate store or creates a new store, depending on OpenFlags flag settings.
/// </summary>
/// <param name="flags">
/// A bitwise combination of enumeration values that specifies the way to open the X.509 certificate store.
/// </param>
void Open(OpenFlags flags);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,25 @@
namespace SystemInterface.Security.Certificate
{
using System.Security.Cryptography.X509Certificates;
/// <summary>
/// This interface wraps the X509Store creation in order to be mock-able.
/// </summary>
public interface IX509StoreFactory
{
#region Public Methods and Operators
/// <summary>
/// Wraps the X509Store creation method.
/// </summary>
/// <param name="storeLocation">
/// One of the enumeration values that specifies the location of the X.509 certificate store.
/// </param>
/// <returns>
/// The <see cref="IX509Store"/>.
/// </returns>
IX509Store Create(StoreLocation storeLocation);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,19 @@
namespace SystemInterface.ServiceModel
{
using System;
/// <summary>
/// This interface wraps a WCF channel and gives a link with the disposable interface.
/// </summary>
public interface IChannelWrap<TService> : IDisposable
{
#region Public Properties
/// <summary>
/// Gets the channel service.
/// </summary>
TService Service { get; }
#endregion
}
}

Просмотреть файл

@ -0,0 +1,40 @@
namespace SystemInterface.ServiceModel
{
using System.Security.Cryptography.X509Certificates;
using System.ServiceModel;
/// <summary>
/// This interface wraps the channel creation in order to be mock-able.
/// </summary>
public interface IChannelWrapFactory
{
#region Public Properties
/// <summary>
/// Gets or sets the service factory.
/// </summary>
ChannelFactory ServiceFactory { get; set; }
/// <summary>
/// Gets or sets the certificate which is used for authentication.
/// </summary>
X509Certificate2 Certificate { get; set; }
#endregion
#region Public Methods and Operators
/// <summary>
/// Wraps the channel creation method.
/// </summary>
/// <param name="enpointConfigurationName">
/// The string that gives the name of the endpoint configuration.
/// </param>
/// <returns>
/// A channel wrap.
/// </returns>
IChannelWrap<TService> CreateChannel<TService>(string enpointConfigurationName) where TService : class;
#endregion
}
}

Просмотреть файл

@ -0,0 +1,9 @@
namespace SystemInterface.ServiceModel
{
/// <summary>
/// This interface wraps the channel creation in order to be mock-able.
/// </summary>
public interface IWebChannelWrapFactory : IChannelWrapFactory
{
}
}

Просмотреть файл

@ -53,18 +53,44 @@
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
<Reference Include="System.DirectoryServices" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Security" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\Build\AssemblySharedInfo.cs">
<Link>Properties\AssemblySharedInfo.cs</Link>
</Compile>
<Compile Include="ActiveDirectory\IDirectoryEntry.cs" />
<Compile Include="ActiveDirectory\IDirectoryEntryFactory.cs" />
<Compile Include="ActiveDirectory\IDirectorySearcher.cs" />
<Compile Include="ActiveDirectory\IDirectorySearcherFactory.cs" />
<Compile Include="ActiveDirectory\IResultPropertyCollection.cs" />
<Compile Include="ActiveDirectory\IResultPropertyValueCollection.cs" />
<Compile Include="ActiveDirectory\ISearchResult.cs" />
<Compile Include="ActiveDirectory\ISearchResultCollection.cs" />
<Compile Include="Attributes\GenerateFactoryAttribute.cs" />
<Compile Include="Collections\Specialized\INameValueCollection.cs" />
<Compile Include="Collections\Specialized\INameValueCollectionFactory.cs" />
<Compile Include="Configuration\IConfigurationManager.cs" />
<Compile Include="Data\DataTable\IDataTable.cs" />
<Compile Include="Data\DataTable\IDataTableFactory.cs" />
<Compile Include="Data\SqlClient\ISqlCommand.cs" />
<Compile Include="Data\SqlClient\ISqlCommandFactory.cs" />
<Compile Include="Data\SqlClient\ISqlConnection.cs" />
<Compile Include="Data\SqlClient\ISqlConnectionFactory.cs" />
<Compile Include="Data\SqlClient\ISqlDataAdapter.cs" />
<Compile Include="Data\SqlClient\ISqlDataAdapterFactory.cs" />
<Compile Include="Data\SqlClient\ISqlDataReader.cs" />
<Compile Include="Data\SqlClient\ISqlParameterCollection.cs" />
<Compile Include="Diagnostics\IProcess.cs" />
<Compile Include="Diagnostics\IProcessStartInfo.cs" />
<Compile Include="Diagnostics\ITraceSource.cs" />
<Compile Include="Globalization\ICultureInfo.cs" />
<Compile Include="IAppDomain.cs" />
<Compile Include="IConsole.cs" />
<Compile Include="IDateTime.cs" />
@ -75,14 +101,20 @@
<Compile Include="IO\IDirectory.Net45.cs" />
<Compile Include="IO\IDirectory.cs" />
<Compile Include="IO\IDirectoryInfo.cs" />
<Compile Include="IO\IDirectoryInfoFactory.cs" />
<Compile Include="IO\IFile.cs" />
<Compile Include="IO\IFileInfo.cs" />
<Compile Include="IO\IFileInfoFactory.cs" />
<Compile Include="IO\IFileStream.cs" />
<Compile Include="IO\IFileStreamFactory.cs" />
<Compile Include="IO\IFileSystemWatcher.cs" />
<Compile Include="IO\IFileSystemWatcherFactory.cs" />
<Compile Include="IO\IMemoryStream.cs" />
<Compile Include="IO\IMemoryStreamFactory.cs" />
<Compile Include="IO\IPath.cs" />
<Compile Include="IO\IStream.cs" />
<Compile Include="IO\IStreamReader.cs" />
<Compile Include="IO\IStreamReaderFactory.cs" />
<Compile Include="IO\IStreamWriter.cs" />
<Compile Include="IO\ITextReader.cs" />
<Compile Include="IVersion.cs" />
@ -91,18 +123,63 @@
<Compile Include="Microsoft.Win32\IRegistryKey.cs" />
<Compile Include="Microsoft.Win32\SafeHandles\ISafeFileHandle.cs" />
<Compile Include="Microsoft.Win32\SafeHandles\ISafeRegistryHandle.cs" />
<Compile Include="Net\IHttpWebRequest.cs" />
<Compile Include="Net\IHttpWebRequestFactory.cs" />
<Compile Include="Net\IHttpWebResponse.cs" />
<Compile Include="Net\IHttpWebResponseFactory.cs" />
<Compile Include="Net\Mail\IMailAddress.cs" />
<Compile Include="Net\Mail\IMailAddressCollection.cs" />
<Compile Include="Net\Mail\IMailAddressFactory.cs" />
<Compile Include="Net\Mail\IMailMessage.cs" />
<Compile Include="Net\Mail\ISmtpClient.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Reflection\IAssembly.cs" />
<Compile Include="Reflection\IAssemblyName.cs" />
<Compile Include="Runtime\Serialization\Json\IDataContractJSonSerializer.cs" />
<Compile Include="Runtime\Serialization\Json\IDataContractJSonSerializerFactory.cs" />
<Compile Include="Security\AccessControl\IDirectorySecurity.cs" />
<Compile Include="Security\AccessControl\IFileSecurity.cs" />
<Compile Include="Security\AccessControl\IRegistrySecurity.cs" />
<Compile Include="Security\Certificate\IKeyInfoX509Data.cs" />
<Compile Include="Security\Certificate\IKeyInfoX509DataFactory.cs" />
<Compile Include="Security\Certificate\IX509Certificate.cs" />
<Compile Include="Security\Certificate\IX509Certificate2Collection.cs" />
<Compile Include="Security\Certificate\IX509Certificate2CollectionFactory.cs" />
<Compile Include="Security\Certificate\IX509CertificateFactory.cs" />
<Compile Include="Security\Certificate\IX509CertificateFactoryWrap.cs" />
<Compile Include="Security\Certificate\IX509Chain.cs" />
<Compile Include="Security\Certificate\IX509ChainElement.cs" />
<Compile Include="Security\Certificate\IX509ChainElementCollection.cs" />
<Compile Include="Security\Certificate\IX509ChainElementCollectionFactory.cs" />
<Compile Include="Security\Certificate\IX509ChainElementEnumerator.cs" />
<Compile Include="Security\Certificate\IX509ChainElementFactory.cs" />
<Compile Include="Security\Certificate\IX509ChainFactory.cs" />
<Compile Include="Security\Certificate\IX509Store.cs" />
<Compile Include="Security\Certificate\IX509StoreFactory.cs" />
<Compile Include="ServiceModel\IChannelWrap.cs" />
<Compile Include="ServiceModel\IChannelWrapFactory.cs" />
<Compile Include="ServiceModel\IWebChannelWrapFactory.cs" />
<Compile Include="Threading\IThread.cs" />
<Compile Include="Timers\ITimer.cs" />
<Compile Include="Timers\ITimerFactory.cs" />
<Compile Include="Web\Script\Serialization\IJavaScriptSerializer.cs" />
<Compile Include="Web\Script\Serialization\IJavaScriptSerializerFactory.cs" />
<Compile Include="Xml\IXComment.cs" />
<Compile Include="Xml\IXCommentFactory.cs" />
<Compile Include="Xml\IXDocument.cs" />
<Compile Include="Xml\IXDocumentFactory.cs" />
<Compile Include="Xml\IXmlDocument.cs" />
<Compile Include="Xml\IXmlDocumentFactory.cs" />
<Compile Include="Xml\IXmlSerializer.cs" />
<Compile Include="Xml\IXmlSerializerFactory.cs" />
<Compile Include="Xml\IXmlWriter.cs" />
<Compile Include="Xml\IXmlWriterFactory.cs" />
</ItemGroup>
<ItemGroup>
<None Include="..\Build\SystemWrapper.snk">
<Link>SystemWrapper.snk</Link>
</None>
<None Include="packages.config" />
<None Include="Settings.StyleCop" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

Просмотреть файл

@ -0,0 +1,81 @@
namespace SystemInterface.Timers
{
using System.ComponentModel;
using System.Timers;
/// <summary>
/// Wrapper for <see cref="System.Timers.Timer"/> class.
/// </summary>
public interface ITimer
{
#region Public Events
/// <summary>
/// Occurs when the <see cref='System.Timers.Timer.Interval'/> has elapsed.
/// </summary>
event ElapsedEventHandler Elapsed;
#endregion
#region Public Properties
/// <summary>
/// Gets or sets a value indicating whether the Timer raises the Tick event each time the specified
/// Interval has elapsed, when Enabled is set to true.
/// </summary>
bool AutoReset { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the <see cref='System.Timers.Timer'/>
/// is able to raise events at a defined interval.
/// </summary>
bool Enabled { get; set; }
/// <summary>
/// Gets or sets the interval on which to raise events.
/// </summary>
double Interval { get; set; }
/// <summary>
/// Sets the enable property in design mode to true by default.
/// </summary>
ISite Site { get; set; }
/// <summary>
/// Gets or sets the object used to marshal event-handler calls that are issued when
/// an interval has elapsed.
/// </summary>
ISynchronizeInvoke SynchronizingObject { get; set; }
#endregion
#region Public Methods and Operators
/// <summary>
/// Notifies the object that initialization is beginning and tells it to stand by.
/// </summary>
void BeginInit();
/// <summary>
/// Disposes of the resources (other than memory) used by the <see cref='System.Timers.Timer'/>.
/// </summary>
void Close();
/// <summary>
/// Notifies the object that initialization is complete.
/// </summary>
void EndInit();
/// <summary>
/// Starts the timing by setting <see cref='System.Timers.Timer.Enabled'/> to <see langword='true'/>.
/// </summary>
void Start();
/// <summary>
/// Stops the timing by setting <see cref='System.Timers.Timer.Enabled'/> to <see langword='false'/>.
/// </summary>
void Stop();
#endregion
}
}

Просмотреть файл

@ -0,0 +1,31 @@
namespace SystemInterface.Timers
{
/// <summary>
/// Factory to create a new <see cref="ITimer"/> instance.
/// </summary>
public interface ITimerFactory
{
#region Public Methods and Operators
/// <summary>
/// Creates a new <see cref="ITimer"/> instance using the default constructor.
/// </summary>
/// <returns>
/// The <see cref="ITimer"/>.
/// </returns>
ITimer Create();
/// <summary>
/// Creates a new <see cref="ITimer"/> instance passing an interval.
/// </summary>
/// <param name="interval">
/// The interval.
/// </param>
/// <returns>
/// The <see cref="ITimer"/>.
/// </returns>
ITimer Create(double interval);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,241 @@
namespace SystemInterface.Web.Script.Serialization
{
using System;
using System.Collections.Generic;
using System.Text;
using System.Web.Script.Serialization;
/// <summary>
/// Wrapper for <see cref="T:System.Web.Script.Serialization.JavaScriptSerializer"/> class.
/// </summary>
public interface IJavaScriptSerializer
{
/// <summary>
/// Gets or sets the maximum length of JSON strings that are accepted by the
/// <see cref="T:System.Web.Script.Serialization.JavaScriptSerializer"/> class.
/// </summary>
/// <returns>
/// The maximum length of JSON strings. The default is 2097152 characters, which is equivalent to 4 MB of Unicode string data.
/// </returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// The property is set to a value that is less than one.
/// </exception>
int MaxJsonLength { get; set; }
/// <summary>
/// Gets or sets the limit for constraining the number of object levels to process.
/// </summary>
/// <returns>
/// The number of object levels. The default is 100.
/// </returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// The property is set to a value that is less than one.
/// </exception>
int RecursionLimit { get; set; }
/// <summary>
/// Converts the given object to the specified type.
/// </summary>
/// <param name="obj">
/// The object to convert.
/// </param>
/// <typeparam name="T">
/// The type to which <paramref name="obj"/> will be converted.
/// </typeparam>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="obj"/> (or a nested member of <paramref name="obj"/>) contains a "__type" property that indicates a custom type,
/// but the type resolver that is associated with the serializer cannot find a corresponding managed type.
/// -or- <paramref name="obj"/> (or a nested member of <paramref name="obj"/>) contains a "__type" property that indicates a custom type,
/// but the result of deserializing the corresponding JSON string cannot be assigned to the expected target type.
/// -or- <paramref name="obj"/> (or a nested member of <paramref name="obj"/>) contains a "__type" property that indicates either
/// <see cref="T:System.Object"/> or a non-instantiable type (for example, an abstract type or an interface).
/// -or- An attempt was made to convert <paramref name="obj"/> to an array-like managed type, which is not supported for use as a
/// deserialization target. -or- It is not possible to convert <paramref name="obj"/> to <paramref name="T"/>.
/// </exception>
/// <exception cref="T:System.ArgumentException">
/// <paramref name="obj"/> is a dictionary type and a non-string key value was encountered.
/// -or- <paramref name="obj"/> includes member definitions that are not available on type <paramref name="T"/>.
/// </exception>
/// <returns>
/// The object that has been converted to the target type.
/// </returns>
T ConvertToType<T>(object obj);
/// <summary>
/// Converts the specified object to the specified type.
/// </summary>
/// <param name="obj">
/// The object to convert.
/// </param>
/// <param name="targetType">
/// The type to convert the object to.
/// </param>
/// <exception cref="T:System.InvalidOperationException">
/// The resulting JSON-formatted string exceeds the value of <see cref="P:System.Web.Script.Serialization.JavaScriptSerializer.MaxJsonLength"/>.
/// -or- <paramref name="obj"/> contains a circular reference. A circular reference occurs when a child object has a reference to a parent
/// object, and the parent object has a reference to the child object.
/// </exception>
/// <exception cref="T:System.ArgumentException">
/// The recursion limit defined by <see cref="P:System.Web.Script.Serialization.JavaScriptSerializer.RecursionLimit"/> was exceeded.
/// </exception>
/// <returns>
/// The serialized JSON string.
/// </returns>
object ConvertToType(object obj,
Type targetType);
/// <summary>
/// Converts the specified JSON string to an object of type <paramref name="T"/>.
/// </summary>
/// <param name="input">
/// The JSON string to be deserialized.
/// </param>
/// <typeparam name="T">
/// The type of the resulting object.
/// </typeparam>
/// <exception cref="T:System.ArgumentException">
/// The <paramref name="input"/> length exceeds the value of <see cref="P:System.Web.Script.Serialization.JavaScriptSerializer.MaxJsonLength"/>.
/// -or- The recursion limit defined by <see cref="P:System.Web.Script.Serialization.JavaScriptSerializer.RecursionLimit"/> was exceeded.
/// -or- <paramref name="input"/> contains an unexpected character sequence.
/// -or- <paramref name="input"/> is a dictionary type and a non-string key value was encountered.
/// -or- <paramref name="input"/> includes member definitions that are not available on type <paramref name="T"/>.
/// </exception>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="input"/> is null.
/// </exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="input"/> contains a "__type" property that indicates a custom type, but the type resolver associated with the serializer
/// cannot find a corresponding managed type.
/// -or- <paramref name="input"/> contains a "__type" property that indicates a custom type, but the result of deserializing the corresponding
/// JSON string cannot be assigned to the expected target type.
/// -or- <paramref name="input"/> contains a "__type" property that indicates either <see cref="T:System.Object"/> or a non-instantiable type
/// (for example, an abstract types or an interface).
/// -or- An attempt was made to convert a JSON array to an array-like managed type that is not supported for use as a JSON deserialization target.
/// -or- It is not possible to convert <paramref name="input"/> to <paramref name="T"/>.
/// </exception>
/// <returns>
/// The deserialized object.
/// </returns>
T Deserialize<T>(string input);
/// <summary>
/// Converts a JSON-formatted string to an object of the specified type.
/// </summary>
/// <param name="input">
/// The JSON string to deserialize.
/// </param>
/// <param name="targetType">
/// The type of the resulting object.
/// </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="input"/> is null.
/// </exception>
/// <exception cref="T:System.ArgumentException">
/// The length of <paramref name="input"/> exceeds the value of <see cref="P:System.Web.Script.Serialization.JavaScriptSerializer.MaxJsonLength"/>.
/// -or- The recursion limit defined by <see cref="P:System.Web.Script.Serialization.JavaScriptSerializer.RecursionLimit"/> was exceeded.
/// -or- <paramref name="input"/> contains an unexpected character sequence.
/// -or- <paramref name="input"/> is a dictionary type and a non-string key value was encountered.
/// -or- <paramref name="input"/> includes member definitions that are not available on the target type.
/// </exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="input"/> contains a "__type" property that indicates a custom type, but the type resolver that is currently associated
/// with the serializer cannot find a corresponding managed type.
/// -or- <paramref name="input"/> contains a "__type" property that indicates a custom type, but the result of deserializing the
/// corresponding JSON string cannot be assigned to the expected target type.
/// -or- <paramref name="input"/> contains a "__type" property that indicates either <see cref="T:System.Object"/> or a non-instantiable
/// type (for example, an abstract type or an interface).
/// -or- An attempt was made to convert a JSON array to an array-like managed type that is not supported for use as a JSON deserialization
/// target.
/// -or- It is not possible to convert <paramref name="input"/> to the target type.
/// </exception>
/// <returns>
/// The deserialized object.
/// </returns>
object Deserialize(string input,
Type targetType);
/// <summary>
/// Converts the specified JSON string to an object graph.
/// </summary>
/// <param name="input">
/// The JSON string to be deserialized.
/// </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="input"/> is null.
/// </exception>
/// <exception cref="T:System.ArgumentException">
/// The <paramref name="input"/> length exceeds the value of <see cref="P:System.Web.Script.Serialization.JavaScriptSerializer.MaxJsonLength"/>.
/// -or- The recursion limit defined by <see cref="P:System.Web.Script.Serialization.JavaScriptSerializer.RecursionLimit"/> was exceeded.
/// -or- <paramref name="input"/> contains an unexpected character sequence. -or- <paramref name="input"/> is a dictionary type and a non-string
/// key value was encountered.
/// -or- <paramref name="input"/> includes member definitions that are not available on the target type.
/// </exception>
/// <exception cref="T:System.InvalidOperationException">
/// <paramref name="input"/> contains a "__type" property that indicates a custom type, but the type resolver that is currently associated with
/// the serializer cannot find a corresponding managed type.
/// -or- <paramref name="input"/> contains a "__type" property that indicates a custom type, but the result of deserializing the corresponding
/// JSON string cannot be assigned to the expected target type.
/// -or- <paramref name="input"/> contains a "__type" property that indicates either <see cref="T:System.Object"/> or a non-instantiable type
/// (for example, an abstract type or an interface).
/// -or- An attempt was made to convert a JSON array to an array-like managed type that is not supported for use as a JSON deserialization target.
/// -or- It is not possible to convert <paramref name="input"/> to the target type.
/// </exception>
/// <returns>
/// The deserialized object.
/// </returns>
object DeserializeObject(string input);
/// <summary>
/// Registers a custom converter with the <see cref="T:System.Web.Script.Serialization.JavaScriptSerializer"/> instance.
/// </summary>
/// <param name="converters">
/// An array that contains the custom converters to be registered.
/// </param>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="converters"/> is null.
/// </exception>
void RegisterConverters(IEnumerable<JavaScriptConverter> converters);
/// <summary>
/// Converts an object to a JSON string.
/// </summary>
/// <param name="obj">
/// The object to serialize.
/// </param>
/// <exception cref="T:System.InvalidOperationException">
/// The resulting JSON string exceeds the value of <see cref="P:System.Web.Script.Serialization.JavaScriptSerializer.MaxJsonLength"/>.
/// -or- <paramref name="obj"/> contains a circular reference. A circular reference occurs when a child object has a reference to a
/// parent object, and the parent object has a reference to the child object.
/// </exception>
/// <exception cref="T:System.ArgumentException">
/// The recursion limit defined by <see cref="P:System.Web.Script.Serialization.JavaScriptSerializer.RecursionLimit"/> was exceeded.
/// </exception>
/// <returns>
/// The serialized JSON string.
/// </returns>
string Serialize(object obj);
/// <summary>
/// Serializes an object and writes the resulting JSON string to the specified <see cref="T:System.Text.StringBuilder"/> object.
/// </summary>
/// <param name="obj">
/// The object to serialize.
/// </param>
/// <param name="output">
/// The <see cref="T:System.Text.StringBuilder"/> object that is used to write the JSON string.
/// </param>
/// <exception cref="T:System.InvalidOperationException">
/// The resulting JSON string exceeds the value of <see cref="P:System.Web.Script.Serialization.JavaScriptSerializer.MaxJsonLength"/>.
/// -or- <paramref name="obj"/> contains a circular reference. A circular reference occurs when a child object has a reference to a
/// parent object, and the parent object has a reference to the child object.
/// </exception>
/// <exception cref="T:System.ArgumentException">
/// The recursion limit defined by <see cref="P:System.Web.Script.Serialization.JavaScriptSerializer.RecursionLimit"/> was exceeded.
/// </exception>
/// <exception cref="T:System.ArgumentNullException">
/// <paramref name="output"/> is null.
/// </exception>
void Serialize(object obj,
StringBuilder output);
}
}

Просмотреть файл

@ -0,0 +1,29 @@
namespace SystemInterface.Web.Script.Serialization
{
using System.Web.Script.Serialization;
/// <summary>
/// Factory that creates a new <see cref="IJavaScriptSerializer"/> instance.
/// </summary>
public interface IJavaScriptSerializerFactory
{
/// <summary>
/// Creates a new instance of the <see cref='IJavaScriptSerializer'/> class.
/// </summary>
/// <returns>
/// The <see cref="IJavaScriptSerializer"/>.
/// </returns>
IJavaScriptSerializer Create();
/// <summary>
/// Creates a new instance of the <see cref="IJavaScriptSerializer"/> class with the specified resolver.
/// </summary>
/// <param name="resolver">
/// The resolver.
/// </param>
/// <returns>
/// The <see cref="IJavaScriptSerializer"/>.
/// </returns>
IJavaScriptSerializer Create(JavaScriptTypeResolver resolver);
}
}

Просмотреть файл

@ -0,0 +1,49 @@
namespace SystemInterface.Xml
{
using System;
using System.Xml;
using System.Xml.Linq;
/// <summary>
/// Defines the contract for the wrapper of the <see cref="XComment"/> class.
/// </summary>
public interface IXComment
{
#region Public Properties
/// <summary>
/// Gets the original <see cref="XComment"/>.
/// </summary>
XComment Comment { get; }
/// <summary>
/// Gets the node type for this node.
/// </summary>
/// <remarks>
/// This property will always return XmlNodeType.Comment.
/// </remarks>
XmlNodeType NodeType { get; }
/// <summary>
/// Gets or sets the string value of this comment.
/// </summary>
/// <exception cref="ArgumentNullException">
/// Thrown if the specified value is null.
/// </exception>
string Value { get; set; }
#endregion
#region Public Methods and Operators
/// <summary>
/// Write this <see cref="XComment"/> to the passed in <see cref="XmlWriter"/>.
/// </summary>
/// <param name="writer">
/// The <see cref="XmlWriter"/> to write this <see cref="XComment"/> to.
/// </param>
void WriteTo(XmlWriter writer);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,35 @@
namespace SystemInterface.Xml
{
using System;
using System.Xml.Linq;
/// <summary>
/// Defines the contract for the factory responsible for the creation of an instance of <see cref="XComment"/>.
/// </summary>
public interface IXCommentFactory
{
#region Public Methods and Operators
/// <overloads>
/// Initializes a new instance of the <see cref="XComment"/> class.
/// </overloads>
/// <summary>
/// Initializes a new instance of the <see cref="XComment"/> class with the specified string content.
/// </summary>
/// <param name="value">
/// The contents of the new XComment object.
/// </param>
/// <exception cref="ArgumentNullException">
/// Thrown if the specified value is null.
/// </exception>
IXComment Create(string value);
/// <summary>
/// Initializes a new comment node from an existing comment node.
/// </summary>
/// <param name="other">Comment node to copy from.</param>
IXComment Create(XComment other);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,159 @@
namespace SystemInterface.Xml
{
using System.IO;
using System.Xml;
using System.Xml.Linq;
/// <summary>
/// Defines the contract for the wrapper of the <see cref="XDocument"/> class.
/// </summary>
public interface IXDocument
{
#region Public Properties
/// <summary>
/// Gets the XML declaration for this document.
/// </summary>
XDeclaration Declaration { get; set; }
/// <summary>
/// Gets the original of <see cref="XDocument"/>.
/// </summary>
XDocument Document { get; }
/// <summary>
/// Gets the Document Type Definition (DTD) for this document.
/// </summary>
XDocumentType DocumentType { get; }
/// <summary>
/// Gets the node type for this node.
/// </summary>
/// <remarks>
/// This property will always return XmlNodeType.Document.
/// </remarks>
XmlNodeType NodeType { get; }
/// <summary>
/// Gets the root element of the XML Tree for this document.
/// </summary>
XElement Root { get; }
#endregion
#region Public Methods and Operators
///<overloads>
/// Outputs this <see cref="XDocument"/>'s underlying XML tree. The output can
/// be saved to a file, a <see cref="Stream"/>, a <see cref="TextWriter"/>,
/// or an <see cref="XmlWriter"/>. Optionally whitespace can be preserved.
/// </overloads>
/// <summary>
/// Output this <see cref="XDocument"/> to a file.
/// </summary>
/// <remarks>
/// The format will be indented by default. If you want
/// no indenting then use the SaveOptions version of Save (see
/// <see cref="XDocument.Save(string, SaveOptions)"/>) enabling
/// SaveOptions.DisableFormatting.
/// There is also an option SaveOptions.OmitDuplicateNamespaces for removing duplicate namespace declarations.
/// Or instead use the SaveOptions as an annotation on this node or its ancestors, then this method will use those options.
/// </remarks>
/// <param name="fileName">
/// The name of the file to output the XML to.
/// </param>
void Save(string fileName);
/// <summary>
/// Output this <see cref="XDocument"/> to a file.
/// </summary>
/// <param name="fileName">
/// The name of the file to output the XML to.
/// </param>
/// <param name="options">
/// If SaveOptions.DisableFormatting is enabled the output is not indented.
/// If SaveOptions.OmitDuplicateNamespaces is enabled duplicate namespace declarations will be removed.
/// </param>
void Save(string fileName,
SaveOptions options);
/// <summary>
/// Output this <see cref="XDocument"/> to the passed in <see cref="Stream"/>.
/// </summary>
/// <remarks>
/// The format will be indented by default. If you want
/// no indenting then use the SaveOptions version of Save (see
/// <see cref="XDocument.Save(Stream, SaveOptions)"/>) enabling
/// SaveOptions.DisableFormatting
/// There is also an option SaveOptions.OmitDuplicateNamespaces for removing duplicate namespace declarations.
/// Or instead use the SaveOptions as an annotation on this node or its ancestors, then this method will use those options.
/// </remarks>
/// <param name="stream">
/// The <see cref="Stream"/> to output this <see cref="XDocument"/> to.
/// </param>
void Save(Stream stream);
/// <summary>
/// Output this <see cref="XDocument"/> to a <see cref="Stream"/>.
/// </summary>
/// <param name="stream">
/// The <see cref="Stream"/> to output the XML to.
/// </param>
/// <param name="options">
/// If SaveOptions.DisableFormatting is enabled the output is not indented.
/// If SaveOptions.OmitDuplicateNamespaces is enabled duplicate namespace declarations will be removed.
/// </param>
void Save(Stream stream,
SaveOptions options);
/// <summary>
/// Output this <see cref="XDocument"/> to the passed in <see cref="TextWriter"/>.
/// </summary>
/// <remarks>
/// The format will be indented by default. If you want
/// no indenting then use the SaveOptions version of Save (see
/// <see cref="XDocument.Save(TextWriter, SaveOptions)"/>) enabling
/// SaveOptions.DisableFormatting
/// There is also an option SaveOptions.OmitDuplicateNamespaces for removing duplicate namespace declarations.
/// Or instead use the SaveOptions as an annotation on this node or its ancestors, then this method will use those options.
/// </remarks>
/// <param name="textWriter">
/// The <see cref="TextWriter"/> to output this <see cref="XDocument"/> to.
/// </param>
void Save(TextWriter textWriter);
/// <summary>
/// Output this <see cref="XDocument"/> to a <see cref="TextWriter"/>.
/// </summary>
/// <param name="textWriter">
/// The <see cref="TextWriter"/> to output the XML to.
/// </param>
/// <param name="options">
/// If SaveOptions.DisableFormatting is enabled the output is not indented.
/// If SaveOptions.OmitDuplicateNamespaces is enabled duplicate namespace declarations will be removed.
/// </param>
void Save(TextWriter textWriter,
SaveOptions options);
/// <summary>
/// Output this <see cref="XDocument"/> to an <see cref="XmlWriter"/>.
/// </summary>
/// <param name="writer">
/// The <see cref="XmlWriter"/> to output the XML to.
/// </param>
void Save(XmlWriter writer);
/// <summary>
/// Output this <see cref="XDocument"/>'s underlying XML tree to the
/// passed in <see cref="XmlWriter"/>.
/// <seealso cref="XDocument.Save(XmlWriter)"/>
/// </summary>
/// <param name="writer">
/// The <see cref="XmlWriter"/> to output the content of this
/// <see cref="XDocument"/>.
/// </param>
void WriteTo(XmlWriter writer);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,238 @@
namespace SystemInterface.Xml
{
using System.IO;
using System.Xml;
using System.Xml.Linq;
/// <summary>
/// Defines the contract for the factory responsible for the creation of an instance of <see cref="IXDocument"/> class.
/// </summary>
public interface IXDocumentFactory
{
#region Public Methods and Operators
/// <overloads>
/// Initializes a new instance of the <see cref="IXDocument"/> class. Overloaded constructors are provided for creating a new empty <see cref="IXDocument"/>, creating an <see cref="IXDocument"/> with a parameter list of initial content, and as a copy of another <see cref="IXDocument"/> object.
/// </overloads>
/// <summary>
/// Initializes a new instance of the <see cref="IXDocument"/> class.
/// </summary>
IXDocument Create();
/// <summary>
/// Initializes a new instance of the <see cref="IXDocument"/> class with the specified content.
/// </summary>
/// <param name="content">
/// A parameter list of content objects to add to this document.
/// </param>
/// <remarks>
/// Valid content includes:
/// <list>
/// <item>Zero or one <see cref="XDocumentType"/> objects</item>
/// <item>Zero or one elements</item>
/// <item>Zero or more comments</item>
/// <item>Zero or more processing instructions</item>
/// </list>
/// See XContainer.Add(object content) for details about the content that can be added using this method.
/// </remarks>
IXDocument Create(params object[] content);
/// <summary>
/// Initializes a new instance of the <see cref="IXDocument"/> class with the specifed <see cref="XDeclaration"/> and content.
/// </summary>
/// <param name="declaration">
/// The XML declaration for the document.
/// </param>
/// <param name="content">
/// The contents of the document.
/// </param>
/// <remarks>
/// Valid content includes:
/// <list>
/// <item>Zero or one <see cref="XDocumentType"/> objects</item>
/// <item>Zero or one elements</item>
/// <item>Zero or more comments</item>
/// <item>Zero or more processing instructions</item>
/// <item></item>
/// </list>
/// See XContainer.Add(object content) for details about the content that can be added using this method.
/// </remarks>
IXDocument Create(XDeclaration declaration,
params object[] content);
/// <summary>
/// Initializes a new instance of the <see cref="IXDocument"/> class from an existing XDocument object.
/// </summary>
/// <param name="other">
/// The <see cref="IXDocument"/> object that will be copied.
/// </param>
IXDocument Create(IXDocument other);
/// <overloads>
/// The Load method provides multiple strategies for creating a new
/// <see cref="IXDocument"/> and initializing it from a data source containing
/// raw XML. Load from a file (passing in a URI to the file), a
/// <see cref="Stream"/>, a <see cref="TextReader"/>, or an
/// <see cref="XmlReader"/>. Note: Use <see cref="XDocument.Parse(string)"/>
/// to create an <see cref="IXDocument"/> from a string containing XML.
/// <seealso cref="XDocument.Parse(string)"/>
/// </overloads>
/// <summary>
/// Create a new <see cref="IXDocument"/> based on the contents of the file
/// referenced by the URI parameter passed in. Note: Use
/// <see cref="XDocument.Parse(string)"/> to create an <see cref="IXDocument"/> from
/// a string containing XML.
/// <seealso cref="XmlReader.Create(string)"/>
/// <seealso cref="XDocument.Parse(string)"/>
/// </summary>
/// <remarks>
/// This method uses the <see cref="XmlReader.Create(string)"/> method to create
/// an <see cref="XmlReader"/> to read the raw XML into the underlying
/// XML tree.
/// </remarks>
/// <param name="uri">
/// A URI string referencing the file to load into a new <see cref="IXDocument"/>.
/// </param>
/// <returns>
/// An <see cref="IXDocument"/> initialized with the contents of the file referenced
/// in the passed in uri parameter.
/// </returns>
IXDocument Load(string uri);
/// <summary>
/// Create a new <see cref="IXDocument"/> based on the contents of the file
/// referenced by the URI parameter passed in. Optionally, whitespace can be preserved.
/// <see cref="XmlReader.Create(string)"/>
/// </summary>
/// <remarks>
/// This method uses the <see cref="XmlReader.Create(string)"/> method to create
/// an <see cref="XmlReader"/> to read the raw XML into an underlying
/// XML tree. If LoadOptions.PreserveWhitespace is enabled then
/// the <see cref="XmlReaderSettings"/> property <see cref="XmlReaderSettings.IgnoreWhitespace"/>
/// is set to false.
/// </remarks>
/// <param name="uri">
/// A string representing the URI of the file to be loaded into a new <see cref="IXDocument"/>.
/// </param>
/// <param name="options">
/// A set of <see cref="LoadOptions"/>.
/// </param>
/// <returns>
/// An <see cref="IXDocument"/> initialized with the contents of the file referenced
/// in the passed uri parameter. If LoadOptions.PreserveWhitespace is enabled then
/// all whitespace will be preserved.
/// </returns>
IXDocument Load(string uri,
LoadOptions options);
/// <summary>
/// Create a new <see cref="IXDocument"/> and initialize its underlying XML tree using
/// the passed <see cref="Stream"/> parameter.
/// </summary>
/// <param name="stream">
/// A <see cref="Stream"/> containing the raw XML to read into the newly
/// created <see cref="IXDocument"/>.
/// </param>
/// <returns>
/// A new <see cref="IXDocument"/> containing the contents of the passed in
/// <see cref="Stream"/>.
/// </returns>
IXDocument Load(Stream stream);
/// <summary>
/// Create a new <see cref="IXDocument"/> and initialize its underlying XML tree using
/// the passed <see cref="Stream"/> parameter. Optionally whitespace handling
/// can be preserved.
/// </summary>
/// <remarks>
/// If LoadOptions.PreserveWhitespace is enabled then
/// the underlying <see cref="XmlReaderSettings"/> property <see cref="XmlReaderSettings.IgnoreWhitespace"/>
/// is set to false.
/// </remarks>
/// <param name="stream">
/// A <see cref="Stream"/> containing the raw XML to read into the newly
/// created <see cref="IXDocument"/>.
/// </param>
/// <param name="options">
/// A set of <see cref="LoadOptions"/>.
/// </param>
/// <returns>
/// A new <see cref="IXDocument"/> containing the contents of the passed in
/// <see cref="Stream"/>.
/// </returns>
IXDocument Load(Stream stream,
LoadOptions options);
/// <summary>
/// Create a new <see cref="IXDocument"/> and initialize its underlying XML tree using
/// the passed <see cref="TextReader"/> parameter.
/// </summary>
/// <param name="textReader">
/// A <see cref="TextReader"/> containing the raw XML to read into the newly
/// created <see cref="IXDocument"/>.
/// </param>
/// <returns>
/// A new <see cref="IXDocument"/> containing the contents of the passed in
/// <see cref="TextReader"/>.
/// </returns>
IXDocument Load(TextReader textReader);
/// <summary>
/// Create a new <see cref="IXDocument"/> and initialize its underlying XML tree using
/// the passed <see cref="TextReader"/> parameter. Optionally whitespace handling
/// can be preserved.
/// </summary>
/// <remarks>
/// If LoadOptions.PreserveWhitespace is enabled then
/// the <see cref="XmlReaderSettings"/> property <see cref="XmlReaderSettings.IgnoreWhitespace"/>
/// is set to false.
/// </remarks>
/// <param name="textReader">
/// A <see cref="TextReader"/> containing the raw XML to read into the newly
/// created <see cref="IXDocument"/>.
/// </param>
/// <param name="options">
/// A set of <see cref="LoadOptions"/>.
/// </param>
/// <returns>
/// A new <see cref="IXDocument"/> containing the contents of the passed in
/// <see cref="TextReader"/>.
/// </returns>
IXDocument Load(TextReader textReader,
LoadOptions options);
/// <summary>
/// Create a new <see cref="IXDocument"/> containing the contents of the
/// passed in <see cref="XmlReader"/>.
/// </summary>
/// <param name="reader">
/// An <see cref="XmlReader"/> containing the XML to be read into the new
/// <see cref="IXDocument"/>.
/// </param>
/// <returns>
/// A new <see cref="IXDocument"/> containing the contents of the passed
/// in <see cref="XmlReader"/>.
/// </returns>
IXDocument Load(XmlReader reader);
/// <summary>
/// Create a new <see cref="IXDocument"/> containing the contents of the
/// passed in <see cref="XmlReader"/>.
/// </summary>
/// <param name="reader">
/// An <see cref="XmlReader"/> containing the XML to be read into the new
/// <see cref="IXDocument"/>.
/// </param>
/// <param name="options">
/// A set of <see cref="LoadOptions"/>.
/// </param>
/// <returns>
/// A new <see cref="IXDocument"/> containing the contents of the passed
/// in <see cref="XmlReader"/>.
/// </returns>
IXDocument Load(XmlReader reader,
LoadOptions options);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,830 @@
namespace SystemInterface.Xml
{
using System;
using System.Collections;
using System.IO;
using System.Xml;
using System.Xml.Schema;
using System.Xml.XPath;
/// <summary>
/// Wrapper for the <see cref="XmlDocument"/> class.
/// </summary>
public interface IXmlDocument
{
#region Public Events
event XmlNodeChangedEventHandler NodeChanged;
event XmlNodeChangedEventHandler NodeChanging;
event XmlNodeChangedEventHandler NodeInserted;
event XmlNodeChangedEventHandler NodeInserting;
event XmlNodeChangedEventHandler NodeRemoved;
event XmlNodeChangedEventHandler NodeRemoving;
#endregion
#region Public Properties
/// <summary>
/// Gets an XmlAttributeCollection containing the attributes of this node.
/// </summary>
XmlAttributeCollection Attributes { get; }
/// <summary>
/// Gets the base URI of the current node.
/// </summary>
String BaseURI { get; }
/// <summary>
/// Gets all the child nodes of the node.
/// </summary>
XmlNodeList ChildNodes { get; }
/// <summary>
/// Gets the root XmlElement for the document.
/// </summary>
XmlElement DocumentElement { get; }
/// <summary>
/// Gets the node for the DOCTYPE declaration.
/// </summary>
XmlDocumentType DocumentType { get; }
/// <summary>
/// Gets the first child of this node.
/// </summary>
XmlNode FirstChild { get; }
/// <summary>
/// Gets a value indicating whether this node has any child nodes.
/// </summary>
bool HasChildNodes { get; }
/// <summary>
/// Gets the XmlImplementation object for this document.
/// </summary>
XmlImplementation Implementation { get; }
string InnerText { set; }
string InnerXml { get; set; }
/// <summary>
/// Gets a value indicating whether the node is read-only.
/// </summary>
bool IsReadOnly { get; }
/// <summary>
/// Gets the last child of this node.
/// </summary>
XmlNode LastChild { get; }
/// <summary>
/// Gets the name of the current node without the namespace prefix.
/// </summary>
String LocalName { get; }
/// <summary>
/// Gets the name of the node.
/// </summary>
String Name { get; }
/// <summary>
/// Gets the XmlNameTable associated with this implementation.
/// </summary>
XmlNameTable NameTable { get; }
/// <summary>
/// Gets the namespace URI of this node.
/// </summary>
string NamespaceURI { get; }
/// <summary>
/// Gets the node immediately following this node.
/// </summary>
XmlNode NextSibling { get; }
/// <summary>
/// Gets the type of the current node.
/// </summary>
XmlNodeType NodeType { get; }
/// <summary>
/// Gets the markup representing this node and all its children.
/// </summary>
string OuterXml { get; }
/// <summary>
/// Gets the XmlDocument that contains this node.
/// </summary>
XmlDocument OwnerDocument { get; }
XmlNode ParentNode { get; }
/// <summary>
/// Gets or sets the namespace prefix of this node.
/// </summary>
string Prefix { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to preserve whitespace.
/// </summary>
bool PreserveWhitespace { get; set; }
/// <summary>
/// Gets the node immediately preceding this node.
/// </summary>
XmlNode PreviousSibling { get; }
IXmlSchemaInfo SchemaInfo { get; }
XmlSchemaSet Schemas { get; set; }
/// <summary>
/// Gets or sets the value of the node.
/// </summary>
string Value { get; set; }
XmlResolver XmlResolver { set; }
#endregion
#region Public Indexers
/// <summary>
/// Retrieves the first child element with the specified name.
/// </summary>
/// <param name="name">
/// The name.
/// </param>
/// <returns>
/// The <see cref="XmlElement"/>.
/// </returns>
XmlElement this[string name] { get; }
/// <summary>
/// Retrieves the first child element with the specified LocalName and NamespaceURI.
/// </summary>
/// <param name="localname">
/// The localname.
/// </param>
/// <param name="ns">
/// The ns.
/// </param>
/// <returns>
/// The <see cref="XmlElement"/>.
/// </returns>
XmlElement this[string localname,
string ns] { get; }
#endregion
#region Public Methods and Operators
/// <summary>
/// Adds the specified node to the end of the list of children of this node.
/// </summary>
/// <param name="newChild">
/// The new child.
/// </param>
/// <returns>
/// The <see cref="XmlNode"/>.
/// </returns>
XmlNode AppendChild(XmlNode newChild);
/// <summary>
/// Creates a duplicate of this node.
/// </summary>
/// <returns>
/// The <see cref="XmlNode"/>.
/// </returns>
XmlNode Clone();
/// <summary>
/// Creates a duplicate of this node.
/// </summary>
/// <param name="deep">
/// The deep.
/// </param>
/// <returns>
/// The <see cref="XmlNode"/>.
/// </returns>
XmlNode CloneNode(bool deep);
/// <summary>
/// Creates an XmlAttribute with the specified name.
/// </summary>
/// <param name="name">
/// The name.
/// </param>
/// <returns>
/// The <see cref="XmlAttribute"/>.
/// </returns>
XmlAttribute CreateAttribute(String name);
/// <summary>
/// Creates an XmlAttribute with the specified LocalName and NamespaceURI.
/// </summary>
/// <param name="qualifiedName">
/// The qualified name.
/// </param>
/// <param name="namespaceURI">
/// The namespace uri.
/// </param>
/// <returns>
/// The <see cref="XmlAttribute"/>.
/// </returns>
XmlAttribute CreateAttribute(String qualifiedName,
String namespaceURI);
/// <summary>
/// Creates a XmlAttribute with the specified Prefix, LocalName, and NamespaceURI.
/// </summary>
/// <param name="prefix">
/// The prefix.
/// </param>
/// <param name="localName">
/// The local name.
/// </param>
/// <param name="namespaceURI">
/// The namespace uri.
/// </param>
/// <returns>
/// The <see cref="XmlAttribute"/>.
/// </returns>
XmlAttribute CreateAttribute(string prefix,
string localName,
string namespaceURI);
/// <summary>
/// Creates a XmlCDataSection containing the specified data.
/// </summary>
/// <param name="data">
/// The data.
/// </param>
/// <returns>
/// The <see cref="XmlCDataSection"/>.
/// </returns>
XmlCDataSection CreateCDataSection(String data);
/// <summary>
/// Creates an XmlComment containing the specified data.
/// </summary>
/// <param name="data">
/// The data.
/// </param>
/// <returns>
/// The <see cref="XmlComment"/>.
/// </returns>
XmlComment CreateComment(String data);
/// <summary>
/// Creates an XmlDocumentFragment.
/// </summary>
/// <returns>
/// The <see cref="XmlDocumentFragment"/>.
/// </returns>
XmlDocumentFragment CreateDocumentFragment();
/// <summary>
/// Returns a new XmlDocumentType object.
/// </summary>
/// <param name="name">
/// The name.
/// </param>
/// <param name="publicId">
/// The public id.
/// </param>
/// <param name="systemId">
/// The system id.
/// </param>
/// <param name="internalSubset">
/// The internal subset.
/// </param>
/// <returns>
/// The <see cref="XmlDocumentType"/>.
/// </returns>
XmlDocumentType CreateDocumentType(string name,
string publicId,
string systemId,
string internalSubset);
/// <summary>
/// Creates an element with the specified name.
/// </summary>
/// <param name="name">
/// The name.
/// </param>
/// <returns>
/// The <see cref="XmlElement"/>.
/// </returns>
XmlElement CreateElement(String name);
/// <summary>
/// Creates an XmlElement with the specified LocalName and NamespaceURI.
/// </summary>
/// <param name="qualifiedName">
/// The qualified name.
/// </param>
/// <param name="namespaceURI">
/// The namespace uri.
/// </param>
/// <returns>
/// The <see cref="XmlElement"/>.
/// </returns>
XmlElement CreateElement(String qualifiedName,
String namespaceURI);
XmlElement CreateElement(string prefix,
string localName,
string namespaceURI);
/// <summary>
/// Creates an XmlEntityReference with the specified name.
/// </summary>
/// <param name="name">
/// The name.
/// </param>
/// <returns>
/// The <see cref="XmlEntityReference"/>.
/// </returns>
XmlEntityReference CreateEntityReference(String name);
XPathNavigator CreateNavigator();
/// <summary>
/// Creates a XmlNode with the specified XmlNodeType, Prefix, Name, and NamespaceURI.
/// </summary>
/// <param name="type">
/// The type.
/// </param>
/// <param name="prefix">
/// The prefix.
/// </param>
/// <param name="name">
/// The name.
/// </param>
/// <param name="namespaceURI">
/// The namespace uri.
/// </param>
/// <returns>
/// The <see cref="XmlNode"/>.
/// </returns>
XmlNode CreateNode(XmlNodeType type,
string prefix,
string name,
string namespaceURI);
/// <summary>
/// Creates an XmlNode with the specified node type, Name, and NamespaceURI.
/// </summary>
/// <param name="nodeTypeString">
/// The node type string.
/// </param>
/// <param name="name">
/// The name.
/// </param>
/// <param name="namespaceURI">
/// The namespace uri.
/// </param>
/// <returns>
/// The <see cref="XmlNode"/>.
/// </returns>
XmlNode CreateNode(string nodeTypeString,
string name,
string namespaceURI);
/// <summary>
/// Creates an XmlNode with the specified XmlNodeType, Name, and NamespaceURI.
/// </summary>
/// <param name="type">
/// The type.
/// </param>
/// <param name="name">
/// The name.
/// </param>
/// <param name="namespaceURI">
/// The namespace uri.
/// </param>
/// <returns>
/// The <see cref="XmlNode"/>.
/// </returns>
XmlNode CreateNode(XmlNodeType type,
string name,
string namespaceURI);
/// <summary>
/// Creates a XmlProcessingInstruction with the specified name and data strings.
/// </summary>
/// <param name="target">
/// The target.
/// </param>
/// <param name="data">
/// The data.
/// </param>
/// <returns>
/// The <see cref="XmlProcessingInstruction"/>.
/// </returns>
XmlProcessingInstruction CreateProcessingInstruction(String target,
String data);
/// <summary>
/// Creates a XmlSignificantWhitespace node.
/// </summary>
/// <param name="text">
/// The text.
/// </param>
/// <returns>
/// The <see cref="XmlSignificantWhitespace"/>.
/// </returns>
XmlSignificantWhitespace CreateSignificantWhitespace(string text);
/// <summary>
/// Creates an XmlText with the specified text.
/// </summary>
/// <param name="text">
/// The text.
/// </param>
/// <returns>
/// The <see cref="XmlText"/>.
/// </returns>
XmlText CreateTextNode(String text);
/// <summary>
/// Creates a XmlWhitespace node.
/// </summary>
/// <param name="text">
/// The text.
/// </param>
/// <returns>
/// The <see cref="XmlWhitespace"/>.
/// </returns>
XmlWhitespace CreateWhitespace(string text);
/// <summary>
/// Creates a XmlDeclaration node with the specified values.
/// </summary>
/// <param name="version">
/// The version.
/// </param>
/// <param name="encoding">
/// The encoding.
/// </param>
/// <param name="standalone">
/// The standalone.
/// </param>
/// <returns>
/// The <see cref="XmlDeclaration"/>.
/// </returns>
XmlDeclaration CreateXmlDeclaration(String version,
string encoding,
string standalone);
bool Equals(Object obj);
/// <summary>
/// Returns the XmlElement with the specified ID.
/// </summary>
/// <param name="elementId">
/// The element id.
/// </param>
/// <returns>
/// The <see cref="XmlElement"/>.
/// </returns>
XmlElement GetElementById(string elementId);
/// <summary>
/// Returns an XmlNodeList containing a list of all descendant elements that match the specified name.
/// </summary>
/// <param name="name">
/// The name.
/// </param>
/// <returns>
/// The <see cref="XmlNodeList"/>.
/// </returns>
XmlNodeList GetElementsByTagName(String name);
/// <summary>
/// Returns a XmlNodeList containing a list of all descendant elements that match the specified name.
/// </summary>
/// <param name="localName">
/// The local name.
/// </param>
/// <param name="namespaceURI">
/// The namespace uri.
/// </param>
/// <returns>
/// The <see cref="XmlNodeList"/>.
/// </returns>
XmlNodeList GetElementsByTagName(String localName,
String namespaceURI);
IEnumerator GetEnumerator();
int GetHashCode();
/// <summary>
/// Looks up the closest xmlns declaration for the given prefix that is in scope for the current node and returns the namespace URI in the declaration.
/// </summary>
/// <param name="prefix">
/// The prefix.
/// </param>
/// <returns>
/// The <see cref="string"/>.
/// </returns>
string GetNamespaceOfPrefix(string prefix);
/// <summary>
/// Looks up the closest xmlns declaration for the given namespace URI that is in scope for the current node and returns the prefix defined in
/// that declaration.
/// </summary>
/// <param name="namespaceURI">
/// The namespace uri.
/// </param>
/// <returns>
/// The <see cref="string"/>.
/// </returns>
string GetPrefixOfNamespace(string namespaceURI);
/// <summary>
/// Returns a Type object which represent this object instance.
/// </summary>
/// <returns>
/// The <see cref="Type"/>.
/// </returns>
Type GetType();
/// <summary>
/// Imports a node from another document to this document.
/// </summary>
/// <param name="node">
/// The node.
/// </param>
/// <param name="deep">
/// The deep.
/// </param>
/// <returns>
/// The <see cref="XmlNode"/>.
/// </returns>
XmlNode ImportNode(XmlNode node,
bool deep);
/// <summary>
/// Inserts the specified node immediately after the specified reference node.
/// </summary>
/// <param name="newChild">
/// The new child.
/// </param>
/// <param name="refChild">
/// The ref child.
/// </param>
/// <returns>
/// The <see cref="XmlNode"/>.
/// </returns>
XmlNode InsertAfter(XmlNode newChild,
XmlNode refChild);
/// <summary>
/// Inserts the specified node immediately before the specified reference node.
/// </summary>
/// <param name="newChild">
/// The new child.
/// </param>
/// <param name="refChild">
/// The ref child.
/// </param>
/// <returns>
/// The <see cref="XmlNode"/>.
/// </returns>
XmlNode InsertBefore(XmlNode newChild,
XmlNode refChild);
/// <summary>
/// Loads the XML document from the specified URL.
/// </summary>
/// <param name="filename">
/// The filename.
/// </param>
void Load(string filename);
void Load(Stream inStream);
/// <summary>
/// Loads the XML document from the specified TextReader.
/// </summary>
/// <param name="txtReader">
/// The txt reader.
/// </param>
void Load(TextReader txtReader);
/// <summary>
/// Loads the XML document from the specified XmlReader.
/// </summary>
/// <param name="reader">
/// The reader.
/// </param>
void Load(XmlReader reader);
/// <summary>
/// Loads the XML document from the specified string.
/// </summary>
/// <param name="xml">
/// The xml.
/// </param>
void LoadXml(string xml);
/// <summary>
/// Puts all XmlText nodes in the full depth of the sub-tree underneath this XmlNode into a "normal" form where only markup (e.g., tags, comments,
/// processing instructions, CDATA sections, and entity references) separates XmlText nodes, that is, there are no adjacent XmlText nodes.
/// </summary>
void Normalize();
/// <summary>
/// Adds the specified node to the beginning of the list of children of this node.
/// </summary>
/// <param name="newChild">
/// The new child.
/// </param>
/// <returns>
/// The <see cref="XmlNode"/>.
/// </returns>
XmlNode PrependChild(XmlNode newChild);
/// <summary>
/// Creates an XmlNode object based on the information in the XmlReader. The reader must be positioned on a node or attribute.
/// </summary>
/// <param name="reader">
/// The reader.
/// </param>
/// <returns>
/// The <see cref="XmlNode"/>.
/// </returns>
XmlNode ReadNode(XmlReader reader);
/// <summary>
/// Removes all the children and/or attributes of the current node.
/// </summary>
void RemoveAll();
/// <summary>
/// Removes specified child node.
/// </summary>
/// <param name="oldChild">
/// The old child.
/// </param>
/// <returns>
/// The <see cref="XmlNode"/>.
/// </returns>
XmlNode RemoveChild(XmlNode oldChild);
/// <summary>
/// Replaces the child node oldChild with newChild node.
/// </summary>
/// <param name="newChild">
/// The new child.
/// </param>
/// <param name="oldChild">
/// The old child.
/// </param>
/// <returns>
/// The <see cref="XmlNode"/>.
/// </returns>
XmlNode ReplaceChild(XmlNode newChild,
XmlNode oldChild);
/// <summary>
/// Saves out the to the file with exact content in the XmlDocument.
/// </summary>
/// <param name="filename">
/// The filename.
/// </param>
void Save(string filename);
/// <summary>
/// Saves out the to the file with exact content in the XmlDocument.
/// </summary>
/// <param name="outStream">
/// The out stream.
/// </param>
void Save(Stream outStream);
/// <summary>
/// Saves out the file with xmldeclaration which has encoding value equal to that of textwriter's encoding
/// </summary>
/// <param name="writer">
/// The writer.
/// </param>
void Save(TextWriter writer);
/// <summary>
/// Saves out the file with xmldeclaration which has encoding value equal to that of textwriter's encoding
/// </summary>
/// <param name="w">
/// The w.
/// </param>
void Save(XmlWriter w);
/// <summary>
/// Selects all nodes that match the xpath expression
/// </summary>
/// <param name="xpath">
/// The xpath.
/// </param>
/// <returns>
/// The <see cref="XmlNodeList"/>.
/// </returns>
XmlNodeList SelectNodes(string xpath);
/// <summary>
/// Selects all nodes that match the xpath expression and given namespace context.
/// </summary>
/// <param name="xpath">
/// The xpath.
/// </param>
/// <param name="nsmgr">
/// The nsmgr.
/// </param>
/// <returns>
/// The <see cref="XmlNodeList"/>.
/// </returns>
XmlNodeList SelectNodes(string xpath,
XmlNamespaceManager nsmgr);
/// <summary>
/// Selects the first node that matches the xpath expression
/// </summary>
/// <param name="xpath">
/// The xpath.
/// </param>
/// <returns>
/// The <see cref="XmlNode"/>.
/// </returns>
XmlNode SelectSingleNode(string xpath);
/// <summary>
/// Selects the first node that matches the xpath expression and given namespace context.
/// </summary>
/// <param name="xpath">
/// The xpath.
/// </param>
/// <param name="nsmgr">
/// The nsmgr.
/// </param>
/// <returns>
/// The <see cref="XmlNode"/>.
/// </returns>
XmlNode SelectSingleNode(string xpath,
XmlNamespaceManager nsmgr);
/// <summary>
/// Test if the DOM implementation implements a specific feature.
/// </summary>
/// <param name="feature">
/// The feature.
/// </param>
/// <param name="version">
/// The version.
/// </param>
/// <returns>
/// The <see cref="bool"/>.
/// </returns>
bool Supports(string feature,
string version);
/// <summary>
/// Returns a String which represents the object instance. The default for an object is to return the fully qualified name of the class.
/// </summary>
/// <returns>
/// The <see cref="string"/>.
/// </returns>
String ToString();
void Validate(ValidationEventHandler validationEventHandler);
void Validate(ValidationEventHandler validationEventHandler,
XmlNode nodeToValidate);
/// <summary>
/// Writes out the to the file with exact content in the XmlDocument.
/// </summary>
/// <param name="xw">
/// The xw.
/// </param>
void WriteContentTo(XmlWriter xw);
/// <summary>
/// Writes out the to the file with exact content in the XmlDocument.
/// </summary>
/// <param name="w">
/// The w.
/// </param>
void WriteTo(XmlWriter w);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,33 @@
namespace SystemInterface.Xml
{
using System.Xml;
/// <summary>
/// Factory to create a new <see cref="IXmlDocument"/> instance.
/// </summary>
public interface IXmlDocumentFactory
{
#region Public Methods and Operators
/// <summary>
/// Creates a new <see cref="IXmlDocument"/> instance using the default constructor.
/// </summary>
/// <returns>
/// The <see cref="IXmlDocument"/>.
/// </returns>
IXmlDocument Create();
/// <summary>
/// Creates a new <see cref="IXmlDocument"/> instance passing the xml name table.
/// </summary>
/// <param name="nt">
/// The nt.
/// </param>
/// <returns>
/// The <see cref="IXmlDocument"/>.
/// </returns>
IXmlDocument Create(XmlNameTable nt);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,267 @@
namespace SystemInterface.Xml
{
using System;
using System.CodeDom.Compiler;
using System.IO;
using System.Reflection;
using System.Security.Policy;
using System.Xml;
using System.Xml.Serialization;
/// <summary>
/// Defines the contract for the wrapper of the <see cref="XmlSerializer"/> class.
/// </summary>
public interface IXmlSerializer
{
#region Public Events
/// <summary>
/// Occurs when the <see cref="T:System.Xml.Serialization.XmlSerializer"/> encounters an XML attribute of unknown type during deserialization.
/// </summary>
event XmlAttributeEventHandler UnknownAttribute;
/// <summary>
/// Occurs when the <see cref="T:System.Xml.Serialization.XmlSerializer"/> encounters an XML element of unknown type during deserialization.
/// </summary>
event XmlElementEventHandler UnknownElement;
/// <summary>
/// Occurs when the <see cref="T:System.Xml.Serialization.XmlSerializer"/> encounters an XML node of unknown type during deserialization.
/// </summary>
event XmlNodeEventHandler UnknownNode;
/// <summary>
/// Occurs during deserialization of a SOAP-encoded XML stream, when the <see cref="T:System.Xml.Serialization.XmlSerializer"/> encounters a recognized type that is not used or is unreferenced.
/// </summary>
event UnreferencedObjectEventHandler UnreferencedObject;
#endregion
#region Public Methods and Operators
/// <summary>
/// Gets a value that indicates whether this <see cref="T:System.Xml.Serialization.XmlSerializer"/> can deserialize a specified XML document.
/// </summary>
/// <returns>
/// true if this <see cref="T:System.Xml.Serialization.XmlSerializer"/> can deserialize the object that the <see cref="T:System.Xml.XmlReader"/> points to; otherwise, false.
/// </returns>
/// <param name="xmlReader">An <see cref="T:System.Xml.XmlReader"/> that points to the document to deserialize. </param>
bool CanDeserialize(XmlReader xmlReader);
/// <summary>
/// Deserializes the XML document contained by the specified <see cref="T:System.IO.Stream"/>.
/// </summary>
/// <returns>
/// The <see cref="T:System.Object"/> being deserialized.
/// </returns>
/// <param name="stream">The <see cref="T:System.IO.Stream"/> that contains the XML document to deserialize. </param>
object Deserialize(Stream stream);
/// <summary>
/// Deserializes the XML document contained by the specified <see cref="T:System.IO.TextReader"/>.
/// </summary>
/// <returns>
/// The <see cref="T:System.Object"/> being deserialized.
/// </returns>
/// <param name="textReader">The <see cref="T:System.IO.TextReader"/> that contains the XML document to deserialize. </param><exception cref="T:System.InvalidOperationException">An error occurred during deserialization. The original exception is available using the <see cref="P:System.Exception.InnerException"/> property. </exception>
object Deserialize(TextReader textReader);
/// <summary>
/// Deserializes the XML document contained by the specified <see cref="T:System.xml.XmlReader"/>.
/// </summary>
/// <returns>
/// The <see cref="T:System.Object"/> being deserialized.
/// </returns>
/// <param name="xmlReader">The <see cref="T:System.xml.XmlReader"/> that contains the XML document to deserialize. </param><exception cref="T:System.InvalidOperationException">An error occurred during deserialization. The original exception is available using the <see cref="P:System.Exception.InnerException"/> property. </exception>
object Deserialize(XmlReader xmlReader);
/// <summary>
/// Deserializes an XML document contained by the specified <see cref="T:System.Xml.XmlReader"/> and allows the overriding of events that occur during deserialization.
/// </summary>
/// <returns>
/// The <see cref="T:System.Object"/> being deserialized.
/// </returns>
/// <param name="xmlReader">The <see cref="T:System.Xml.XmlReader"/> that contains the document to deserialize.</param><param name="events">An instance of the <see cref="T:System.Xml.Serialization.XmlDeserializationEvents"/> class. </param>
object Deserialize(XmlReader xmlReader,
XmlDeserializationEvents events);
/// <summary>
/// Deserializes the XML document contained by the specified <see cref="T:System.xml.XmlReader"/> and encoding style.
/// </summary>
/// <returns>
/// The deserialized object.
/// </returns>
/// <param name="xmlReader">The <see cref="T:System.xml.XmlReader"/> that contains the XML document to deserialize. </param><param name="encodingStyle">The encoding style of the serialized XML. </param><exception cref="T:System.InvalidOperationException">An error occurred during deserialization. The original exception is available using the <see cref="P:System.Exception.InnerException"/> property. </exception>
object Deserialize(XmlReader xmlReader,
string encodingStyle);
/// <summary>
/// Deserializes the object using the data contained by the specified <see cref="T:System.Xml.XmlReader"/>.
/// </summary>
/// <returns>
/// The object being deserialized.
/// </returns>
/// <param name="xmlReader">An instance of the <see cref="T:System.Xml.XmlReader"/> class used to read the document.</param><param name="encodingStyle">The encoding used.</param><param name="events">An instance of the <see cref="T:System.Xml.Serialization.XmlDeserializationEvents"/> class. </param>
object Deserialize(XmlReader xmlReader,
string encodingStyle,
XmlDeserializationEvents events);
/// <summary>
/// Returns an array of <see cref="T:System.Xml.Serialization.XmlSerializer"/> objects created from an array of <see cref="T:System.Xml.Serialization.XmlTypeMapping"/> objects.
/// </summary>
/// <returns>
/// An array of <see cref="T:System.Xml.Serialization.XmlSerializer"/> objects.
/// </returns>
/// <param name="mappings">An array of <see cref="T:System.Xml.Serialization.XmlTypeMapping"/> that maps one type to another. </param>
XmlSerializer[] FromMappings(XmlMapping[] mappings);
/// <summary>
/// Returns an instance of the <see cref="T:System.Xml.Serialization.XmlSerializer"/> class from the specified mappings.
/// </summary>
/// <returns>
/// An instance of the <see cref="T:System.Xml.Serialization.XmlSerializer"/> class.
/// </returns>
/// <param name="mappings">An array of <see cref="T:System.Xml.Serialization.XmlMapping"/> objects.</param><param name="type">The <see cref="T:System.Type"/> of the deserialized object.</param>
XmlSerializer[] FromMappings(XmlMapping[] mappings,
Type type);
/// <summary>
/// Returns an instance of the <see cref="T:System.Xml.Serialization.XmlSerializer"/> class created from mappings of one XML type to another.
/// </summary>
/// <returns>
/// An instance of the <see cref="T:System.Xml.Serialization.XmlSerializer"/> class.
/// </returns>
/// <param name="mappings">An array of <see cref="T:System.Xml.Serialization.XmlMapping"/> objects used to map one type to another.</param><param name="evidence">An instance of the <see cref="T:System.Security.Policy.Evidence"/> class that contains host and assembly data presented to the common language runtime policy system.</param>
[Obsolete("This method is obsolete and will be removed in a future release of the .NET Framework. Please use an overload of FromMappings which does not take an Evidence parameter. See http://go2.microsoft.com/fwlink/?LinkId=131738 for more information.")]
XmlSerializer[] FromMappings(XmlMapping[] mappings,
Evidence evidence);
/// <summary>
/// Returns an array of <see cref="T:System.Xml.Serialization.XmlSerializer"/> objects created from an array of types.
/// </summary>
/// <returns>
/// An array of <see cref="T:System.Xml.Serialization.XmlSerializer"/> objects.
/// </returns>
/// <param name="types">An array of <see cref="T:System.Type"/> objects. </param>
XmlSerializer[] FromTypes(Type[] types);
/// <summary>
/// Returns an assembly that contains custom-made serializers used to serialize or deserialize the specified type or types, using the specified mappings.
/// </summary>
/// <returns>
/// An <see cref="T:System.Reflection.Assembly"/> object that contains serializers for the supplied types and mappings.
/// </returns>
/// <param name="types">A collection of types.</param><param name="mappings">A collection of <see cref="T:System.Xml.Serialization.XmlMapping"/> objects used to convert one type to another.</param>
Assembly GenerateSerializer(Type[] types,
XmlMapping[] mappings);
/// <summary>
/// Returns an assembly that contains custom-made serializers used to serialize or deserialize the specified type or types, using the specified mappings and compiler settings and options.
/// </summary>
/// <returns>
/// An <see cref="T:System.Reflection.Assembly"/> that contains special versions of the <see cref="T:System.Xml.Serialization.XmlSerializer"/>.
/// </returns>
/// <param name="types">An array of type <see cref="T:System.Type"/> that contains objects used to serialize and deserialize data.</param><param name="mappings">An array of type <see cref="T:System.Xml.Serialization.XmlMapping"/> that maps the XML data to the type data.</param><param name="parameters">An instance of the <see cref="T:System.CodeDom.Compiler.CompilerParameters"/> class that represents the parameters used to invoke a compiler.</param>
Assembly GenerateSerializer(Type[] types,
XmlMapping[] mappings,
CompilerParameters parameters);
/// <summary>
/// Returns the name of the assembly that contains one or more versions of the <see cref="T:System.Xml.Serialization.XmlSerializer"/> especially created to serialize or deserialize the specified type.
/// </summary>
/// <returns>
/// The name of the assembly that contains an <see cref="T:System.Xml.Serialization.XmlSerializer"/> for the type.
/// </returns>
/// <param name="type">The <see cref="T:System.Type"/> you are deserializing.</param>
string GetXmlSerializerAssemblyName(Type type);
/// <summary>
/// Returns the name of the assembly that contains the serializer for the specified type in the specified namespace.
/// </summary>
/// <returns>
/// The name of the assembly that contains specially built serializers.
/// </returns>
/// <param name="type">The <see cref="T:System.Type"/> you are interested in.</param><param name="defaultNamespace">The namespace of the type.</param>
string GetXmlSerializerAssemblyName(Type type,
string defaultNamespace);
/// <summary>
/// Serializes the specified <see cref="T:System.Object"/> and writes the XML document to a file using the specified <see cref="T:System.IO.TextWriter"/>.
/// </summary>
/// <param name="textWriter">The <see cref="T:System.IO.TextWriter"/> used to write the XML document. </param><param name="o">The <see cref="T:System.Object"/> to serialize. </param>
void Serialize(TextWriter textWriter,
object o);
/// <summary>
/// Serializes the specified <see cref="T:System.Object"/> and writes the XML document to a file using the specified <see cref="T:System.IO.TextWriter"/> and references the specified namespaces.
/// </summary>
/// <param name="textWriter">The <see cref="T:System.IO.TextWriter"/> used to write the XML document. </param><param name="o">The <see cref="T:System.Object"/> to serialize. </param><param name="namespaces">The <see cref="T:System.Xml.Serialization.XmlSerializerNamespaces"/> that contains namespaces for the generated XML document. </param><exception cref="T:System.InvalidOperationException">An error occurred during serialization. The original exception is available using the <see cref="P:System.Exception.InnerException"/> property. </exception>
void Serialize(TextWriter textWriter,
object o,
XmlSerializerNamespaces namespaces);
/// <summary>
/// Serializes the specified <see cref="T:System.Object"/> and writes the XML document to a file using the specified <see cref="T:System.IO.Stream"/>.
/// </summary>
/// <param name="stream">The <see cref="T:System.IO.Stream"/> used to write the XML document. </param><param name="o">The <see cref="T:System.Object"/> to serialize. </param><exception cref="T:System.InvalidOperationException">An error occurred during serialization. The original exception is available using the <see cref="P:System.Exception.InnerException"/> property. </exception>
void Serialize(Stream stream,
object o);
/// <summary>
/// Serializes the specified <see cref="T:System.Object"/> and writes the XML document to a file using the specified <see cref="T:System.IO.Stream"/>that references the specified namespaces.
/// </summary>
/// <param name="stream">The <see cref="T:System.IO.Stream"/> used to write the XML document. </param><param name="o">The <see cref="T:System.Object"/> to serialize. </param><param name="namespaces">The <see cref="T:System.Xml.Serialization.XmlSerializerNamespaces"/> referenced by the object. </param><exception cref="T:System.InvalidOperationException">An error occurred during serialization. The original exception is available using the <see cref="P:System.Exception.InnerException"/> property. </exception>
void Serialize(Stream stream,
object o,
XmlSerializerNamespaces namespaces);
/// <summary>
/// Serializes the specified <see cref="T:System.Object"/> and writes the XML document to a file using the specified <see cref="T:System.Xml.XmlWriter"/>.
/// </summary>
/// <param name="xmlWriter">The <see cref="T:System.xml.XmlWriter"/> used to write the XML document. </param>
/// <param name="o">The <see cref="T:System.Object"/> to serialize. </param>
/// <exception cref="T:System.InvalidOperationException">An error occurred during serialization. The original exception is available using the <see cref="P:System.Exception.InnerException"/> property. </exception>
void Serialize(IXmlWriter xmlWriter,
object o);
/// <summary>
/// Serializes the specified <see cref="T:System.Object"/> and writes the XML document to a file using the specified <see cref="T:System.Xml.XmlWriter"/> and references the specified namespaces.
/// </summary>
/// <param name="xmlWriter">The <see cref="T:System.xml.XmlWriter"/> used to write the XML document. </param>
/// <param name="o">The <see cref="T:System.Object"/> to serialize. </param>
/// <param name="namespaces">The <see cref="T:System.Xml.Serialization.XmlSerializerNamespaces"/> referenced by the object. </param>
/// <exception cref="T:System.InvalidOperationException">An error occurred during serialization. The original exception is available using the <see cref="P:System.Exception.InnerException"/> property. </exception>
void Serialize(IXmlWriter xmlWriter,
object o,
XmlSerializerNamespaces namespaces);
/// <summary>
/// Serializes the specified object and writes the XML document to a file using the specified <see cref="T:System.Xml.XmlWriter"/> and references the specified namespaces and encoding style.
/// </summary>
/// <param name="xmlWriter">The <see cref="T:System.xml.XmlWriter"/> used to write the XML document. </param>
/// <param name="o">The object to serialize. </param>
/// <param name="namespaces">The <see cref="T:System.Xml.Serialization.XmlSerializerNamespaces"/> referenced by the object. </param>
/// <param name="encodingStyle">The encoding style of the serialized XML. </param>
/// <exception cref="T:System.InvalidOperationException">An error occurred during serialization. The original exception is available using the <see cref="P:System.Exception.InnerException"/> property. </exception>
void Serialize(IXmlWriter xmlWriter,
object o,
XmlSerializerNamespaces namespaces,
string encodingStyle);
/// <summary>
/// Serializes the specified <see cref="T:System.Object"/> and writes the XML document to a file using the specified <see cref="T:System.Xml.XmlWriter"/>, XML namespaces, and encoding.
/// </summary>
/// <param name="xmlWriter">The <see cref="T:System.Xml.XmlWriter"/> used to write the XML document.</param>
/// <param name="o">The object to serialize.</param>
/// <param name="namespaces">An instance of the XmlSerializaerNamespaces that contains namespaces and prefixes to use.</param>
/// <param name="encodingStyle">The encoding used in the document.</param>
/// <param name="id">For SOAP encoded messages, the base used to generate id attributes. </param>
void Serialize(IXmlWriter xmlWriter,
object o,
XmlSerializerNamespaces namespaces,
string encodingStyle,
string id);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,89 @@
namespace SystemInterface.Xml
{
using System;
using System.Security.Policy;
using System.Xml.Serialization;
/// <summary>
/// Defines the contract for the factory responsible for the creation of the <see cref="XmlSerializer"/> wrapped by an instance of <see cref="IXmlSerializer"/>.
/// </summary>
public interface IXmlSerializerFactory
{
#region Public Methods and Operators
/// <summary>
/// Initializes a new instance of the <see cref="T:System.Xml.Serialization.XmlSerializer"/> class that can serialize objects of type <see cref="T:System.Object"/> into XML document instances, and deserialize XML document instances into objects of type <see cref="T:System.Object"/>. Each object to be serialized can itself contain instances of classes, which this overload overrides with other classes. This overload also specifies the default namespace for all the XML elements and the class to use as the XML root element.
/// </summary>
/// <param name="type">The type of the object that this <see cref="T:System.Xml.Serialization.XmlSerializer"/> can serialize.</param><param name="overrides">An <see cref="T:System.Xml.Serialization.XmlAttributeOverrides"/> that extends or overrides the behavior of the class specified in the <paramref name="type"/> parameter.</param><param name="extraTypes">A <see cref="T:System.Type"/> array of additional object types to serialize.</param><param name="root">An <see cref="T:System.Xml.Serialization.XmlRootAttribute"/> that defines the XML root element properties.</param><param name="defaultNamespace">The default namespace of all XML elements in the XML document.</param><param name="location">The location of the types.</param>
IXmlSerializer Create(Type type,
XmlAttributeOverrides overrides,
Type[] extraTypes,
XmlRootAttribute root,
string defaultNamespace,
string location);
/// <summary>
/// Initializes a new instance of the <see cref="T:System.Xml.Serialization.XmlSerializer"/> class that can serialize objects of the specified type into XML document instances, and deserialize XML document instances into objects of the specified type. This overload allows you to supply other types that can be encountered during a serialization or deserialization operation, as well as a default namespace for all XML elements, the class to use as the XML root element, its location, and credentials required for access.
/// </summary>
/// <param name="type">The type of the object that this <see cref="T:System.Xml.Serialization.XmlSerializer"/> can serialize.</param><param name="overrides">An <see cref="T:System.Xml.Serialization.XmlAttributeOverrides"/> that extends or overrides the behavior of the class specified in the <paramref name="type"/> parameter.</param><param name="extraTypes">A <see cref="T:System.Type"/> array of additional object types to serialize.</param><param name="root">An <see cref="T:System.Xml.Serialization.XmlRootAttribute"/> that defines the XML root element properties.</param><param name="defaultNamespace">The default namespace of all XML elements in the XML document.</param><param name="location">The location of the types.</param><param name="evidence">An instance of the <see cref="T:System.Security.Policy.Evidence"/> class that contains credentials required to access types.</param>
IXmlSerializer Create(Type type,
XmlAttributeOverrides overrides,
Type[] extraTypes,
XmlRootAttribute root,
string defaultNamespace,
string location,
Evidence evidence);
/// <summary>
/// Initializes a new instance of the <see cref="T:System.Xml.Serialization.XmlSerializer"/> class that can serialize objects of type <see cref="T:System.Object"/> into XML document instances, and deserialize XML document instances into objects of type <see cref="T:System.Object"/>. Each object to be serialized can itself contain instances of classes, which this overload overrides with other classes. This overload also specifies the default namespace for all the XML elements and the class to use as the XML root element.
/// </summary>
/// <param name="type">The type of the object that this <see cref="T:System.Xml.Serialization.XmlSerializer"/> can serialize. </param><param name="overrides">An <see cref="T:System.Xml.Serialization.XmlAttributeOverrides"/> that extends or overrides the behavior of the class specified in the <paramref name="type"/> parameter. </param><param name="extraTypes">A <see cref="T:System.Type"/> array of additional object types to serialize. </param><param name="root">An <see cref="T:System.Xml.Serialization.XmlRootAttribute"/> that defines the XML root element properties. </param><param name="defaultNamespace">The default namespace of all XML elements in the XML document. </param>
IXmlSerializer Create(Type type,
XmlAttributeOverrides overrides,
Type[] extraTypes,
XmlRootAttribute root,
string defaultNamespace);
/// <summary>
/// Initializes a new instance of the <see cref="T:System.Xml.Serialization.XmlSerializer"/> class that can serialize objects of the specified type into XML documents, and deserialize an XML document into object of the specified type. It also specifies the class to use as the XML root element.
/// </summary>
/// <param name="type">The type of the object that this <see cref="T:System.Xml.Serialization.XmlSerializer"/> can serialize. </param><param name="root">An <see cref="T:System.Xml.Serialization.XmlRootAttribute"/> that represents the XML root element. </param>
IXmlSerializer Create(Type type,
XmlRootAttribute root);
/// <summary>
/// Initializes a new instance of the <see cref="T:System.Xml.Serialization.XmlSerializer"/> class that can serialize objects of the specified type into XML documents, and deserialize XML documents into object of a specified type. If a property or field returns an array, the <paramref name="extraTypes"/> parameter specifies objects that can be inserted into the array.
/// </summary>
/// <param name="type">The type of the object that this <see cref="T:System.Xml.Serialization.XmlSerializer"/> can serialize. </param><param name="extraTypes">A <see cref="T:System.Type"/> array of additional object types to serialize. </param>
IXmlSerializer Create(Type type,
Type[] extraTypes);
/// <summary>
/// Initializes a new instance of the <see cref="T:System.Xml.Serialization.XmlSerializer"/> class that can serialize objects of the specified type into XML documents, and deserialize XML documents into objects of the specified type. Each object to be serialized can itself contain instances of classes, which this overload can override with other classes.
/// </summary>
/// <param name="type">The type of the object to serialize. </param><param name="overrides">An <see cref="T:System.Xml.Serialization.XmlAttributeOverrides"/>. </param>
IXmlSerializer Create(Type type,
XmlAttributeOverrides overrides);
/// <summary>
/// Initializes an instance of the <see cref="T:System.Xml.Serialization.XmlSerializer"/> class using an object that maps one type to another.
/// </summary>
/// <param name="xmlTypeMapping">An <see cref="T:System.Xml.Serialization.XmlTypeMapping"/> that maps one type to another. </param>
IXmlSerializer Create(XmlTypeMapping xmlTypeMapping);
/// <summary>
/// Initializes a new instance of the <see cref="T:System.Xml.Serialization.XmlSerializer"/> class that can serialize objects of the specified type into XML documents, and deserialize XML documents into objects of the specified type.
/// </summary>
/// <param name="type">The type of the object that this <see cref="T:System.Xml.Serialization.XmlSerializer"/> can serialize. </param>
IXmlSerializer Create(Type type);
/// <summary>
/// Initializes a new instance of the <see cref="T:System.Xml.Serialization.XmlSerializer"/> class that can serialize objects of the specified type into XML documents, and deserialize XML documents into objects of the specified type. Specifies the default namespace for all the XML elements.
/// </summary>
/// <param name="type">The type of the object that this <see cref="T:System.Xml.Serialization.XmlSerializer"/> can serialize. </param><param name="defaultNamespace">The default namespace to use for all the XML elements. </param>
IXmlSerializer Create(Type type,
string defaultNamespace);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,415 @@

#pragma warning disable 1584,1711,1572,1581,1580
namespace SystemInterface.Xml
{
using System;
using System.Xml;
using System.Xml.XPath;
/// <summary>
/// Defines the contract for the wrapper of the <see cref="XmlWriter"/> class.
/// </summary>
public interface IXmlWriter : IDisposable
{
#region Public Properties
/// <summary>
/// Gets the <see cref="T:System.Xml.XmlWriterSettings"/> object used to create this <see cref="T:System.Xml.XmlWriter"/> instance.
/// </summary>
/// <returns>
/// The <see cref="T:System.Xml.XmlWriterSettings"/> object used to create this writer instance. If this writer was not created using the <see cref="Overload:System.Xml.XmlWriter.Create"/> method, this property returns null.
/// </returns>
/// <exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
XmlWriterSettings Settings { get; }
/// <summary>
/// When overridden in a derived class, gets the state of the writer.
/// </summary>
/// <returns>
/// One of the <see cref="T:System.Xml.WriteState"/> values.
/// </returns>
/// <exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
WriteState WriteState { get; }
/// <summary>
/// Gets the original <see cref="XmlWriter"/>.
/// </summary>
XmlWriter Writer { get; }
/// <summary>
/// When overridden in a derived class, gets the current xml:lang scope.
/// </summary>
/// <returns>
/// The current xml:lang scope.
/// </returns>
/// <exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
string XmlLang { get; }
/// <summary>
/// When overridden in a derived class, gets an <see cref="T:System.Xml.XmlSpace"/> representing the current xml:space scope.
/// </summary>
/// <returns>
/// An XmlSpace representing the current xml:space scope.Value Meaning NoneThis is the default if no xml:space scope exists.DefaultThe current scope is xml:space="default".PreserveThe current scope is xml:space="preserve".
/// </returns>
/// <exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
XmlSpace XmlSpace { get; }
#endregion
#region Public Methods and Operators
/// <summary>
/// When overridden in a derived class, closes this stream and the underlying stream.
/// </summary>
/// <exception cref="T:System.InvalidOperationException">A call is made to write more output after Close has been called or the result of this call is an invalid XML document.</exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void Close();
/// <summary>
/// Releases all resources used by the current instance of the <see cref="T:System.Xml.XmlWriter"/> class.
/// </summary>
/// <exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void Dispose();
/// <summary>
/// When overridden in a derived class, flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream.
/// </summary>
/// <exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void Flush();
/// <summary>
/// When overridden in a derived class, returns the closest prefix defined in the current namespace scope for the namespace URI.
/// </summary>
/// <returns>
/// The matching prefix or null if no matching namespace URI is found in the current scope.
/// </returns>
/// <param name="ns">The namespace URI whose prefix you want to find.</param><exception cref="T:System.ArgumentException"><paramref name="ns"/> is either null or String.Empty.</exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
string LookupPrefix(string ns);
/// <summary>
/// When overridden in a derived class, writes an attribute with the specified local name, namespace URI, and value.
/// </summary>
/// <param name="localName">The local name of the attribute.</param><param name="ns">The namespace URI to associate with the attribute.</param><param name="value">The value of the attribute.</param><exception cref="T:System.InvalidOperationException">The state of writer is not WriteState.Element or writer is closed. </exception><exception cref="T:System.ArgumentException">The xml:space or xml:lang attribute value is invalid. </exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteAttributeString(string localName,
string ns,
string value);
/// <summary>
/// When overridden in a derived class, writes out the attribute with the specified local name and value.
/// </summary>
/// <param name="localName">The local name of the attribute.</param><param name="value">The value of the attribute.</param><exception cref="T:System.InvalidOperationException">The state of writer is not WriteState.Element or writer is closed. </exception><exception cref="T:System.ArgumentException">The xml:space or xml:lang attribute value is invalid. </exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteAttributeString(string localName,
string value);
/// <summary>
/// When overridden in a derived class, writes out the attribute with the specified prefix, local name, namespace URI, and value.
/// </summary>
/// <param name="prefix">The namespace prefix of the attribute.</param><param name="localName">The local name of the attribute.</param><param name="ns">The namespace URI of the attribute.</param><param name="value">The value of the attribute.</param><exception cref="T:System.InvalidOperationException">The state of writer is not WriteState.Element or writer is closed. </exception><exception cref="T:System.ArgumentException">The xml:space or xml:lang attribute value is invalid. </exception><exception cref="T:System.Xml.XmlException">The <paramref name="localName"/> or <paramref name="ns"/> is null. </exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteAttributeString(string prefix,
string localName,
string ns,
string value);
/// <summary>
/// When overridden in a derived class, writes out all the attributes found at the current position in the <see cref="T:System.Xml.XmlReader"/>.
/// </summary>
/// <param name="reader">The XmlReader from which to copy the attributes.</param><param name="defattr">true to copy the default attributes from the XmlReader; otherwise, false.</param><exception cref="T:System.ArgumentNullException"><paramref name="reader"/> is null. </exception><exception cref="T:System.Xml.XmlException">The reader is not positioned on an element, attribute or XmlDeclaration node. </exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteAttributes(XmlReader reader,
bool defattr);
/// <summary>
/// When overridden in a derived class, encodes the specified binary bytes as Base64 and writes out the resulting text.
/// </summary>
/// <param name="buffer">Byte array to encode.</param><param name="index">The position in the buffer indicating the start of the bytes to write.</param><param name="count">The number of bytes to write.</param><exception cref="T:System.ArgumentNullException"><paramref name="buffer"/> is null. </exception><exception cref="T:System.ArgumentOutOfRangeException"><paramref name="index"/> or <paramref name="count"/> is less than zero. -or-The buffer length minus <paramref name="index"/> is less than <paramref name="count"/>.</exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteBase64(byte[] buffer,
int index,
int count);
/// <summary>
/// When overridden in a derived class, encodes the specified binary bytes as BinHex and writes out the resulting text.
/// </summary>
/// <param name="buffer">Byte array to encode.</param><param name="index">The position in the buffer indicating the start of the bytes to write.</param><param name="count">The number of bytes to write.</param><exception cref="T:System.ArgumentNullException"><paramref name="buffer"/> is null.</exception><exception cref="T:System.InvalidOperationException">The writer is closed or in error state.</exception><exception cref="T:System.ArgumentOutOfRangeException"><paramref name="index"/> or <paramref name="count"/> is less than zero. -or-The buffer length minus <paramref name="index"/> is less than <paramref name="count"/>.</exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteBinHex(byte[] buffer,
int index,
int count);
/// <summary>
/// When overridden in a derived class, writes out a &lt;![CDATA[...]]&gt; block containing the specified text.
/// </summary>
/// <param name="text">The text to place inside the CDATA block.</param><exception cref="T:System.ArgumentException">The text would result in a non-well formed XML document.</exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteCData(string text);
/// <summary>
/// When overridden in a derived class, forces the generation of a character entity for the specified Unicode character value.
/// </summary>
/// <param name="ch">The Unicode character for which to generate a character entity.</param><exception cref="T:System.ArgumentException">The character is in the surrogate pair character range, 0xd800 - 0xdfff.</exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteCharEntity(char ch);
/// <summary>
/// When overridden in a derived class, writes text one buffer at a time.
/// </summary>
/// <param name="buffer">Character array containing the text to write.</param><param name="index">The position in the buffer indicating the start of the text to write.</param><param name="count">The number of characters to write.</param><exception cref="T:System.ArgumentNullException"><paramref name="buffer"/> is null.</exception><exception cref="T:System.ArgumentOutOfRangeException"><paramref name="index"/> or <paramref name="count"/> is less than zero.-or-The buffer length minus <paramref name="index"/> is less than <paramref name="count"/>; the call results in surrogate pair characters being split or an invalid surrogate pair being written.</exception><exception cref="T:System.ArgumentException">The <paramref name="buffer"/> parameter value is not valid.</exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteChars(char[] buffer,
int index,
int count);
/// <summary>
/// When overridden in a derived class, writes out a comment &lt;!--...--&gt; containing the specified text.
/// </summary>
/// <param name="text">Text to place inside the comment.</param><exception cref="T:System.ArgumentException">The text would result in a non-well-formed XML document.</exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteComment(string text);
/// <summary>
/// When overridden in a derived class, writes the DOCTYPE declaration with the specified name and optional attributes.
/// </summary>
/// <param name="name">The name of the DOCTYPE. This must be non-empty.</param><param name="pubid">If non-null it also writes PUBLIC "pubid" "sysid" where <paramref name="pubid"/> and <paramref name="sysid"/> are replaced with the value of the given arguments.</param><param name="sysid">If <paramref name="pubid"/> is null and <paramref name="sysid"/> is non-null it writes SYSTEM "sysid" where <paramref name="sysid"/> is replaced with the value of this argument.</param><param name="subset">If non-null it writes [subset] where subset is replaced with the value of this argument.</param><exception cref="T:System.InvalidOperationException">This method was called outside the prolog (after the root element). </exception><exception cref="T:System.ArgumentException">The value for <paramref name="name"/> would result in invalid XML.</exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteDocType(string name,
string pubid,
string sysid,
string subset);
/// <summary>
/// Writes an element with the specified local name and value.
/// </summary>
/// <param name="localName">The local name of the element.</param><param name="value">The value of the element.</param><exception cref="T:System.ArgumentException">The <paramref name="localName"/> value is null or an empty string.-or-The parameter values are not valid.</exception><exception cref="T:System.Text.EncoderFallbackException">There is a character in the buffer that is a valid XML character but is not valid for the output encoding. For example, if the output encoding is ASCII, you should only use characters from the range of 0 to 127 for element and attribute names. The invalid character might be in the argument of this method or in an argument of previous methods that were writing to the buffer. Such characters are escaped by character entity references when possible (for example, in text nodes or attribute values). However, the character entity reference is not allowed in element and attribute names, comments, processing instructions, or CDATA sections.</exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteElementString(string localName,
string value);
/// <summary>
/// Writes an element with the specified local name, namespace URI, and value.
/// </summary>
/// <param name="localName">The local name of the element.</param><param name="ns">The namespace URI to associate with the element.</param><param name="value">The value of the element.</param><exception cref="T:System.ArgumentException">The <paramref name="localName"/> value is null or an empty string.-or-The parameter values are not valid.</exception><exception cref="T:System.Text.EncoderFallbackException">There is a character in the buffer that is a valid XML character but is not valid for the output encoding. For example, if the output encoding is ASCII, you should only use characters from the range of 0 to 127 for element and attribute names. The invalid character might be in the argument of this method or in an argument of previous methods that were writing to the buffer. Such characters are escaped by character entity references when possible (for example, in text nodes or attribute values). However, the character entity reference is not allowed in element and attribute names, comments, processing instructions, or CDATA sections.</exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteElementString(string localName,
string ns,
string value);
/// <summary>
/// Writes an element with the specified prefix, local name, namespace URI, and value.
/// </summary>
/// <param name="prefix">The prefix of the element.</param><param name="localName">The local name of the element.</param><param name="ns">The namespace URI of the element.</param><param name="value">The value of the element.</param><exception cref="T:System.ArgumentException">The <paramref name="localName"/> value is null or an empty string.-or-The parameter values are not valid.</exception><exception cref="T:System.Text.EncoderFallbackException">There is a character in the buffer that is a valid XML character but is not valid for the output encoding. For example, if the output encoding is ASCII, you should only use characters from the range of 0 to 127 for element and attribute names. The invalid character might be in the argument of this method or in an argument of previous methods that were writing to the buffer. Such characters are escaped by character entity references when possible (for example, in text nodes or attribute values). However, the character entity reference is not allowed in element and attribute names, comments, processing instructions, or CDATA sections.</exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteElementString(string prefix,
string localName,
string ns,
string value);
/// <summary>
/// When overridden in a derived class, closes the previous <see cref="M:System.Xml.XmlWriter.WriteStartAttribute(System.String,System.String)"/> call.
/// </summary>
/// <exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteEndAttribute();
/// <summary>
/// When overridden in a derived class, closes any open elements or attributes and puts the writer back in the Start state.
/// </summary>
/// <exception cref="T:System.ArgumentException">The XML document is invalid.</exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteEndDocument();
/// <summary>
/// When overridden in a derived class, closes one element and pops the corresponding namespace scope.
/// </summary>
/// <exception cref="T:System.InvalidOperationException">This results in an invalid XML document.</exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteEndElement();
/// <summary>
/// When overridden in a derived class, writes out an entity reference as &amp;name;.
/// </summary>
/// <param name="name">The name of the entity reference.</param><exception cref="T:System.ArgumentException"><paramref name="name"/> is either null or String.Empty.</exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteEntityRef(string name);
/// <summary>
/// When overridden in a derived class, closes one element and pops the corresponding namespace scope.
/// </summary>
/// <exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteFullEndElement();
/// <summary>
/// When overridden in a derived class, writes out the specified name, ensuring it is a valid name according to the W3C XML 1.0 recommendation (http://www.w3.org/TR/1998/REC-xml-19980210#NT-Name).
/// </summary>
/// <param name="name">The name to write.</param><exception cref="T:System.ArgumentException"><paramref name="name"/> is not a valid XML name; or <paramref name="name"/> is either null or String.Empty.</exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteName(string name);
/// <summary>
/// When overridden in a derived class, writes out the specified name, ensuring it is a valid NmToken according to the W3C XML 1.0 recommendation (http://www.w3.org/TR/1998/REC-xml-19980210#NT-Name).
/// </summary>
/// <param name="name">The name to write.</param><exception cref="T:System.ArgumentException"><paramref name="name"/> is not a valid NmToken; or <paramref name="name"/> is either null or String.Empty.</exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteNmToken(string name);
/// <summary>
/// When overridden in a derived class, copies everything from the reader to the writer and moves the reader to the start of the next sibling.
/// </summary>
/// <param name="reader">The <see cref="T:System.Xml.XmlReader"/> to read from.</param><param name="defattr">true to copy the default attributes from the XmlReader; otherwise, false.</param><exception cref="T:System.ArgumentNullException"><paramref name="reader"/> is null.</exception><exception cref="T:System.ArgumentException"><paramref name="reader"/> contains invalid characters.</exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteNode(XmlReader reader,
bool defattr);
/// <summary>
/// Copies everything from the <see cref="T:System.Xml.XPath.XPathNavigator"/> object to the writer. The position of the <see cref="T:System.Xml.XPath.XPathNavigator"/> remains unchanged.
/// </summary>
/// <param name="navigator">The <see cref="T:System.Xml.XPath.XPathNavigator"/> to copy from.</param><param name="defattr">true to copy the default attributes; otherwise, false.</param><exception cref="T:System.ArgumentNullException"><paramref name="navigator"/> is null.</exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteNode(XPathNavigator navigator,
bool defattr);
/// <summary>
/// When overridden in a derived class, writes out a processing instruction with a space between the name and text as follows: &lt;?name text?&gt;.
/// </summary>
/// <param name="name">The name of the processing instruction.</param><param name="text">The text to include in the processing instruction.</param><exception cref="T:System.ArgumentException">The text would result in a non-well formed XML document.<paramref name="name"/> is either null or String.Empty.This method is being used to create an XML declaration after <see cref="M:System.Xml.XmlWriter.WriteStartDocument"/> has already been called. </exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteProcessingInstruction(string name,
string text);
/// <summary>
/// When overridden in a derived class, writes out the namespace-qualified name. This method looks up the prefix that is in scope for the given namespace.
/// </summary>
/// <param name="localName">The local name to write.</param><param name="ns">The namespace URI for the name.</param><exception cref="T:System.ArgumentException"><paramref name="localName"/> is either null or String.Empty.<paramref name="localName"/> is not a valid name. </exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteQualifiedName(string localName,
string ns);
/// <summary>
/// When overridden in a derived class, writes raw markup manually from a character buffer.
/// </summary>
/// <param name="buffer">Character array containing the text to write.</param><param name="index">The position within the buffer indicating the start of the text to write.</param><param name="count">The number of characters to write.</param><exception cref="T:System.ArgumentNullException"><paramref name="buffer"/> is null.</exception><exception cref="T:System.ArgumentOutOfRangeException"><paramref name="index"/> or <paramref name="count"/> is less than zero. -or-The buffer length minus <paramref name="index"/> is less than <paramref name="count"/>.</exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteRaw(char[] buffer,
int index,
int count);
/// <summary>
/// When overridden in a derived class, writes raw markup manually from a string.
/// </summary>
/// <param name="data">String containing the text to write.</param><exception cref="T:System.ArgumentException"><paramref name="data"/> is either null or String.Empty.</exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteRaw(string data);
/// <summary>
/// Writes the start of an attribute with the specified local name and namespace URI.
/// </summary>
/// <param name="localName">The local name of the attribute.</param><param name="ns">The namespace URI of the attribute.</param><exception cref="T:System.Text.EncoderFallbackException">There is a character in the buffer that is a valid XML character but is not valid for the output encoding. For example, if the output encoding is ASCII, you should only use characters from the range of 0 to 127 for element and attribute names. The invalid character might be in the argument of this method or in an argument of previous methods that were writing to the buffer. Such characters are escaped by character entity references when possible (for example, in text nodes or attribute values). However, the character entity reference is not allowed in element and attribute names, comments, processing instructions, or CDATA sections.</exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteStartAttribute(string localName,
string ns);
/// <summary>
/// When overridden in a derived class, writes the start of an attribute with the specified prefix, local name, and namespace URI.
/// </summary>
/// <param name="prefix">The namespace prefix of the attribute.</param><param name="localName">The local name of the attribute.</param><param name="ns">The namespace URI for the attribute.</param><exception cref="T:System.Text.EncoderFallbackException">There is a character in the buffer that is a valid XML character but is not valid for the output encoding. For example, if the output encoding is ASCII, you should only use characters from the range of 0 to 127 for element and attribute names. The invalid character might be in the argument of this method or in an argument of previous methods that were writing to the buffer. Such characters are escaped by character entity references when possible (for example, in text nodes or attribute values). However, the character entity reference is not allowed in element and attribute names, comments, processing instructions, or CDATA sections. </exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteStartAttribute(string prefix,
string localName,
string ns);
/// <summary>
/// Writes the start of an attribute with the specified local name.
/// </summary>
/// <param name="localName">The local name of the attribute.</param><exception cref="T:System.InvalidOperationException">The writer is closed.</exception><exception cref="T:System.Text.EncoderFallbackException">There is a character in the buffer that is a valid XML character but is not valid for the output encoding. For example, if the output encoding is ASCII, you should only use characters from the range of 0 to 127 for element and attribute names. The invalid character might be in the argument of this method or in an argument of previous methods that were writing to the buffer. Such characters are escaped by character entity references when possible (for example, in text nodes or attribute values). However, the character entity reference is not allowed in element and attribute names, comments, processing instructions, or CDATA sections.</exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteStartAttribute(string localName);
/// <summary>
/// When overridden in a derived class, writes the XML declaration with the version "1.0".
/// </summary>
/// <exception cref="T:System.InvalidOperationException">This is not the first write method called after the constructor.</exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteStartDocument();
/// <summary>
/// When overridden in a derived class, writes the XML declaration with the version "1.0" and the standalone attribute.
/// </summary>
/// <param name="standalone">If true, it writes "standalone=yes"; if false, it writes "standalone=no".</param><exception cref="T:System.InvalidOperationException">This is not the first write method called after the constructor. </exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteStartDocument(bool standalone);
/// <summary>
/// When overridden in a derived class, writes the specified start tag and associates it with the given namespace.
/// </summary>
/// <param name="localName">The local name of the element.</param><param name="ns">The namespace URI to associate with the element. If this namespace is already in scope and has an associated prefix, the writer automatically writes that prefix also.</param><exception cref="T:System.InvalidOperationException">The writer is closed.</exception><exception cref="T:System.Text.EncoderFallbackException">There is a character in the buffer that is a valid XML character but is not valid for the output encoding. For example, if the output encoding is ASCII, you should only use characters from the range of 0 to 127 for element and attribute names. The invalid character might be in the argument of this method or in an argument of previous methods that were writing to the buffer. Such characters are escaped by character entity references when possible (for example, in text nodes or attribute values). However, the character entity reference is not allowed in element and attribute names, comments, processing instructions, or CDATA sections.</exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteStartElement(string localName,
string ns);
/// <summary>
/// When overridden in a derived class, writes the specified start tag and associates it with the given namespace and prefix.
/// </summary>
/// <param name="prefix">The namespace prefix of the element.</param><param name="localName">The local name of the element.</param><param name="ns">The namespace URI to associate with the element.</param><exception cref="T:System.InvalidOperationException">The writer is closed.</exception><exception cref="T:System.Text.EncoderFallbackException">There is a character in the buffer that is a valid XML character but is not valid for the output encoding. For example, if the output encoding is ASCII, you should only use characters from the range of 0 to 127 for element and attribute names. The invalid character might be in the argument of this method or in an argument of previous methods that were writing to the buffer. Such characters are escaped by character entity references when possible (for example, in text nodes or attribute values). However, the character entity reference is not allowed in element and attribute names, comments, processing instructions, or CDATA sections.</exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteStartElement(string prefix,
string localName,
string ns);
/// <summary>
/// When overridden in a derived class, writes out a start tag with the specified local name.
/// </summary>
/// <param name="localName">The local name of the element.</param><exception cref="T:System.InvalidOperationException">The writer is closed.</exception><exception cref="T:System.Text.EncoderFallbackException">There is a character in the buffer that is a valid XML character but is not valid for the output encoding. For example, if the output encoding is ASCII, you should only use characters from the range of 0 to 127 for element and attribute names. The invalid character might be in the argument of this method or in an argument of previous methods that were writing to the buffer. Such characters are escaped by character entity references when possible (for example, in text nodes or attribute values). However, the character entity reference is not allowed in element and attribute names, comments, processing instructions, or CDATA sections. </exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteStartElement(string localName);
/// <summary>
/// When overridden in a derived class, writes the given text content.
/// </summary>
/// <param name="text">The text to write.</param><exception cref="T:System.ArgumentException">The text string contains an invalid surrogate pair.</exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteString(string text);
/// <summary>
/// When overridden in a derived class, generates and writes the surrogate character entity for the surrogate character pair.
/// </summary>
/// <param name="lowChar">The low surrogate. This must be a value between 0xDC00 and 0xDFFF.</param><param name="highChar">The high surrogate. This must be a value between 0xD800 and 0xDBFF.</param><exception cref="T:System.ArgumentException">An invalid surrogate character pair was passed.</exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteSurrogateCharEntity(char lowChar,
char highChar);
/// <summary>
/// Writes the object value.
/// </summary>
/// <param name="value">The object value to write.Note   With the release of the .NET Framework 3.5, this method accepts <see cref="T:System.DateTimeOffset"/> as a parameter.</param><exception cref="T:System.ArgumentException">An invalid value was specified.</exception><exception cref="T:System.ArgumentNullException">The <paramref name="value"/> is null.</exception><exception cref="T:System.InvalidOperationException">The writer is closed or in error state.</exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteValue(object value);
/// <summary>
/// Writes a <see cref="T:System.String"/> value.
/// </summary>
/// <param name="value">The <see cref="T:System.String"/> value to write.</param><exception cref="T:System.ArgumentException">An invalid value was specified.</exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteValue(string value);
/// <summary>
/// Writes a <see cref="T:System.Boolean"/> value.
/// </summary>
/// <param name="value">The <see cref="T:System.Boolean"/> value to write.</param><exception cref="T:System.ArgumentException">An invalid value was specified.</exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteValue(bool value);
/// <summary>
/// Writes a <see cref="T:System.DateTime"/> value.
/// </summary>
/// <param name="value">The <see cref="T:System.DateTime"/> value to write.</param><exception cref="T:System.ArgumentException">An invalid value was specified.</exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteValue(DateTime value);
/// <summary>
/// Writes a <see cref="T:System.DateTimeOffset"/> value.
/// </summary>
/// <param name="value">The <see cref="T:System.DateTimeOffset"/> value to write.</param><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteValue(DateTimeOffset value);
/// <summary>
/// Writes a <see cref="T:System.Double"/> value.
/// </summary>
/// <param name="value">The <see cref="T:System.Double"/> value to write.</param><exception cref="T:System.ArgumentException">An invalid value was specified.</exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteValue(double value);
/// <summary>
/// Writes a single-precision floating-point number.
/// </summary>
/// <param name="value">The single-precision floating-point number to write.</param><exception cref="T:System.ArgumentException">An invalid value was specified.</exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteValue(float value);
/// <summary>
/// Writes a <see cref="T:System.Decimal"/> value.
/// </summary>
/// <param name="value">The <see cref="T:System.Decimal"/> value to write.</param><exception cref="T:System.ArgumentException">An invalid value was specified.</exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteValue(Decimal value);
/// <summary>
/// Writes a <see cref="T:System.Int32"/> value.
/// </summary>
/// <param name="value">The <see cref="T:System.Int32"/> value to write.</param><exception cref="T:System.ArgumentException">An invalid value was specified.</exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteValue(int value);
/// <summary>
/// Writes a <see cref="T:System.Int64"/> value.
/// </summary>
/// <param name="value">The <see cref="T:System.Int64"/> value to write.</param><exception cref="T:System.ArgumentException">An invalid value was specified.</exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteValue(long value);
/// <summary>
/// When overridden in a derived class, writes out the given white space.
/// </summary>
/// <param name="ws">The string of white space characters.</param><exception cref="T:System.ArgumentException">The string contains non-white space characters.</exception><exception cref="T:System.InvalidOperationException">An <see cref="T:System.Xml.XmlWriter"/> method was called before a previous asynchronous operation finished. In this case, <see cref="T:System.InvalidOperationException"/> is thrown with the message “An asynchronous operation is already in progress.”</exception>
void WriteWhitespace(string ws);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,129 @@

#pragma warning disable 1584,1711,1572,1581,1580
namespace SystemInterface.Xml
{
using System.IO;
using System.Text;
using System.Xml;
/// <summary>
/// Defines the contract for the factory responsible for the creation of an instance of <see cref="XmlWriter"/> class.
/// </summary>
public interface IXmlWriterFactory
{
#region Public Methods and Operators
/// <summary>
/// Creates a new <see cref="T:System.Xml.XmlWriter"/> instance using the specified filename.
/// </summary>
/// <returns>
/// An <see cref="T:System.Xml.XmlWriter"/> object.
/// </returns>
/// <param name="outputFileName">The file to which you want to write. The <see cref="T:System.Xml.XmlWriter"/> creates a file at the specified path and writes to it in XML 1.0 text syntax. The <paramref name="outputFileName"/> must be a file system path.</param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="url"/> value is null.</exception>
IXmlWriter Create(string outputFileName);
/// <summary>
/// Creates a new <see cref="T:System.Xml.XmlWriter"/> instance using the filename and <see cref="T:System.Xml.XmlWriterSettings"/> object.
/// </summary>
/// <returns>
/// An <see cref="T:System.Xml.XmlWriter"/> object.
/// </returns>
/// <param name="outputFileName">The file to which you want to write. The <see cref="T:System.Xml.XmlWriter"/> creates a file at the specified path and writes to it in XML 1.0 text syntax. The <paramref name="outputFileName"/> must be a file system path.</param>
/// <param name="settings">The <see cref="T:System.Xml.XmlWriterSettings"/> object used to configure the new <see cref="T:System.Xml.XmlWriter"/> instance. If this is null, a <see cref="T:System.Xml.XmlWriterSettings"/> with default settings is used.If the <see cref="T:System.Xml.XmlWriter"/> is being used with the <see cref="M:System.Xml.Xsl.XslCompiledTransform.Transform(System.String,System.Xml.XmlWriter)"/> method, you should use the <see cref="P:System.Xml.Xsl.XslCompiledTransform.OutputSettings"/> property to obtain an <see cref="T:System.Xml.XmlWriterSettings"/> object with the correct settings. This ensures that the created <see cref="T:System.Xml.XmlWriter"/> object has the correct output settings.</param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="url"/> value is null.</exception>
IXmlWriter Create(string outputFileName,
XmlWriterSettings settings);
/// <summary>
/// Creates a new <see cref="T:System.Xml.XmlWriter"/> instance using the specified stream.
/// </summary>
/// <returns>
/// An <see cref="T:System.Xml.XmlWriter"/> object.
/// </returns>
/// <param name="output">The stream to which you want to write. The <see cref="T:System.Xml.XmlWriter"/> writes XML 1.0 text syntax and appends it to the specified stream.</param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="stream"/> value is null.</exception>
IXmlWriter Create(Stream output);
/// <summary>
/// Creates a new <see cref="T:System.Xml.XmlWriter"/> instance using the stream and <see cref="T:System.Xml.XmlWriterSettings"/> object.
/// </summary>
/// <returns>
/// An <see cref="T:System.Xml.XmlWriter"/> object.
/// </returns>
/// <param name="output">The stream to which you want to write. The <see cref="T:System.Xml.XmlWriter"/> writes XML 1.0 text syntax and appends it to the specified stream.</param>
/// <param name="settings">The <see cref="T:System.Xml.XmlWriterSettings"/> object used to configure the new <see cref="T:System.Xml.XmlWriter"/> instance. If this is null, a <see cref="T:System.Xml.XmlWriterSettings"/> with default settings is used.If the <see cref="T:System.Xml.XmlWriter"/> is being used with the <see cref="M:System.Xml.Xsl.XslCompiledTransform.Transform(System.String,System.Xml.XmlWriter)"/> method, you should use the <see cref="P:System.Xml.Xsl.XslCompiledTransform.OutputSettings"/> property to obtain an <see cref="T:System.Xml.XmlWriterSettings"/> object with the correct settings. This ensures that the created <see cref="T:System.Xml.XmlWriter"/> object has the correct output settings.</param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="stream"/> value is null.</exception>
IXmlWriter Create(Stream output,
XmlWriterSettings settings);
/// <summary>
/// Creates a new <see cref="T:System.Xml.XmlWriter"/> instance using the specified <see cref="T:System.IO.TextWriter"/>.
/// </summary>
/// <returns>
/// An <see cref="T:System.Xml.XmlWriter"/> object.
/// </returns>
/// <param name="output">The <see cref="T:System.IO.TextWriter"/> to which you want to write. The <see cref="T:System.Xml.XmlWriter"/> writes XML 1.0 text syntax and appends it to the specified <see cref="T:System.IO.TextWriter"/>.</param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="text"/> value is null.</exception>
IXmlWriter Create(TextWriter output);
/// <summary>
/// Creates a new <see cref="T:System.Xml.XmlWriter"/> instance using the <see cref="T:System.IO.TextWriter"/> and <see cref="T:System.Xml.XmlWriterSettings"/> objects.
/// </summary>
/// <returns>
/// An <see cref="T:System.Xml.XmlWriter"/> object.
/// </returns>
/// <param name="output">The <see cref="T:System.IO.TextWriter"/> to which you want to write. The <see cref="T:System.Xml.XmlWriter"/> writes XML 1.0 text syntax and appends it to the specified <see cref="T:System.IO.TextWriter"/>.</param>
/// <param name="settings">The <see cref="T:System.Xml.XmlWriterSettings"/> object used to configure the new <see cref="T:System.Xml.XmlWriter"/> instance. If this is null, a <see cref="T:System.Xml.XmlWriterSettings"/> with default settings is used.If the <see cref="T:System.Xml.XmlWriter"/> is being used with the <see cref="M:System.Xml.Xsl.XslCompiledTransform.Transform(System.String,System.Xml.XmlWriter)"/> method, you should use the <see cref="P:System.Xml.Xsl.XslCompiledTransform.OutputSettings"/> property to obtain an <see cref="T:System.Xml.XmlWriterSettings"/> object with the correct settings. This ensures that the created <see cref="T:System.Xml.XmlWriter"/> object has the correct output settings.</param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="text"/> value is null.</exception>
IXmlWriter Create(TextWriter output,
XmlWriterSettings settings);
/// <summary>
/// Creates a new <see cref="T:System.Xml.XmlWriter"/> instance using the specified <see cref="T:System.Text.StringBuilder"/>.
/// </summary>
/// <returns>
/// An <see cref="T:System.Xml.XmlWriter"/> object.
/// </returns>
/// <param name="output">The <see cref="T:System.Text.StringBuilder"/> to which to write to. Content written by the <see cref="T:System.Xml.XmlWriter"/> is appended to the <see cref="T:System.Text.StringBuilder"/>.</param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="builder"/> value is null.</exception>
IXmlWriter Create(StringBuilder output);
/// <summary>
/// Creates a new <see cref="T:System.Xml.XmlWriter"/> instance using the <see cref="T:System.Text.StringBuilder"/> and <see cref="T:System.Xml.XmlWriterSettings"/> objects.
/// </summary>
/// <returns>
/// An <see cref="T:System.Xml.XmlWriter"/> object.
/// </returns>
/// <param name="output">The <see cref="T:System.Text.StringBuilder"/> to which to write to. Content written by the <see cref="T:System.Xml.XmlWriter"/> is appended to the <see cref="T:System.Text.StringBuilder"/>.</param>
/// <param name="settings">The <see cref="T:System.Xml.XmlWriterSettings"/> object used to configure the new <see cref="T:System.Xml.XmlWriter"/> instance. If this is null, a <see cref="T:System.Xml.XmlWriterSettings"/> with default settings is used.If the <see cref="T:System.Xml.XmlWriter"/> is being used with the <see cref="M:System.Xml.Xsl.XslCompiledTransform.Transform(System.String,System.Xml.XmlWriter)"/> method, you should use the <see cref="P:System.Xml.Xsl.XslCompiledTransform.OutputSettings"/> property to obtain an <see cref="T:System.Xml.XmlWriterSettings"/> object with the correct settings. This ensures that the created <see cref="T:System.Xml.XmlWriter"/> object has the correct output settings.</param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="builder"/> value is null.</exception>
IXmlWriter Create(StringBuilder output,
XmlWriterSettings settings);
/// <summary>
/// Creates a new <see cref="T:System.Xml.XmlWriter"/> instance using the specified <see cref="T:System.Xml.XmlWriter"/> object.
/// </summary>
/// <returns>
/// An <see cref="T:System.Xml.XmlWriter"/> object that is wrapped around the specified <see cref="T:System.Xml.XmlWriter"/> object.
/// </returns>
/// <param name="output">The <see cref="T:System.Xml.XmlWriter"/> object that you want to use as the underlying writer.</param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="writer"/> value is null.</exception>
IXmlWriter Create(XmlWriter output);
/// <summary>
/// Creates a new <see cref="T:System.Xml.XmlWriter"/> instance using the specified <see cref="T:System.Xml.XmlWriter"/> and <see cref="T:System.Xml.XmlWriterSettings"/> objects.
/// </summary>
/// <returns>
/// An <see cref="T:System.Xml.XmlWriter"/> object that is wrapped around the specified <see cref="T:System.Xml.XmlWriter"/> object.
/// </returns>
/// <param name="output">The <see cref="T:System.Xml.XmlWriter"/> object that you want to use as the underlying writer.</param>
/// <param name="settings">The <see cref="T:System.Xml.XmlWriterSettings"/> object used to configure the new <see cref="T:System.Xml.XmlWriter"/> instance. If this is null, a <see cref="T:System.Xml.XmlWriterSettings"/> with default settings is used.If the <see cref="T:System.Xml.XmlWriter"/> is being used with the <see cref="M:System.Xml.Xsl.XslCompiledTransform.Transform(System.String,System.Xml.XmlWriter)"/> method, you should use the <see cref="P:System.Xml.Xsl.XslCompiledTransform.OutputSettings"/> property to obtain an <see cref="T:System.Xml.XmlWriterSettings"/> object with the correct settings. This ensures that the created <see cref="T:System.Xml.XmlWriter"/> object has the correct output settings.</param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="writer"/> value is null.</exception>
IXmlWriter Create(XmlWriter output,
XmlWriterSettings settings);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="DeveloperInTheFlow.FactoryGenerator" version="2.0.0.1" targetFramework="net45" developmentDependency="true" />
<package id="NUnit" version="3.0.1" targetFramework="net45" />
</packages>

Просмотреть файл

@ -0,0 +1,103 @@
namespace SystemWrapper.Tests.ActiveDirectory
// ReSharper disable InconsistentNaming
// ReSharper disable AccessToStaticMemberViaDerivedType
// ReSharper disable SealedMemberInSealedClass
{
using SystemInterface.ActiveDirectory;
using SystemWrapper.ActiveDirectory;
using NUnit.Framework;
using Testeroids;
using Assert = Testeroids.Assert;
public abstract class DirectorySearcherSpecs
{
public abstract class given_instantiated_Sut : ContextSpecification<DirectorySearcherWrap>
{
#region Context
private IDirectoryEntry InjectedDirectoryEntry { get; set; }
protected override void InstantiateMocks()
{
base.InstantiateMocks();
this.InjectedDirectoryEntry = new DirectoryEntryWrap("GC://liebherr.i");
}
protected override void EstablishContext()
{
base.EstablishContext();
}
protected override DirectorySearcherWrap CreateSubjectUnderTest()
{
return new DirectorySearcherWrap(this.InjectedDirectoryEntry, 20, null)
{
SizeLimit = 20,
Filter = string.Format("(&(objectcategory=user)(objectclass=user)(|(displayname={0})(cn={0})))", "Br*")
};
}
#endregion
public sealed class when_FindAll_is_called: given_instantiated_Sut
{
#region Context
public ISearchResultCollection Result { get; private set; }
protected override void Because()
{
this.Result = this.Sut.FindAll();
}
public override void BaseTestFixtureTearDown()
{
base.BaseTestFixtureTearDown();
this.Result.Dispose();
}
#endregion
[Test]
public void then_Result_contains_20_results()
{
Assert.AreEqual(20, this.Result.Count);
}
[Test]
public void then_each_result_contains_at_least_a_property()
{
foreach (var result in this.Result)
{
Assert.IsTrue(result.Properties.Count > 0);
}
}
}
public sealed class when_FindOne_is_called : given_instantiated_Sut
{
#region Context
public ISearchResult Result { get; private set; }
protected override void Because()
{
this.Result = this.Sut.FindOne();
}
#endregion
[Test]
public void then_Result_contains_at_least_a_result()
{
Assert.IsTrue(this.Result.Properties.Count > 0);
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,21 @@
namespace SystemWrapper.Tests.ActiveDirectory
{
using System.DirectoryServices.AccountManagement;
using SystemWrapper.ActiveDirectory;
using SystemWrapper.ActiveDirectory.Contracts;
public class GroupPrincipalFactory : IGroupPrincipalFactory
{
#region Public Methods and Operators
public IGroupPrincipal Create(IPrincipalContext principalContext,
string groupName)
{
var groupPrincipal = GroupPrincipal.FindByIdentity(principalContext.PrincipalContextInstance, groupName);
return new GroupPrincipalWrap(groupPrincipal);
}
#endregion
}
}

Просмотреть файл

@ -0,0 +1,14 @@
namespace SystemWrapper.Tests.ActiveDirectory
{
using SystemWrapper.ActiveDirectory.Contracts;
public interface IGroupPrincipalFactory
{
#region Public Methods and Operators
IGroupPrincipal Create(IPrincipalContext principalContext,
string groupName);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,83 @@
namespace SystemWrapper.Tests.ActiveDirectory
// ReSharper disable InconsistentNaming
// ReSharper disable AccessToStaticMemberViaDerivedType
// ReSharper disable SealedMemberInSealedClass
{
using System.DirectoryServices.AccountManagement;
using SystemWrapper.ActiveDirectory;
using SystemWrapper.ActiveDirectory.Contracts;
using NUnit.Framework;
using Testeroids;
using Assert = Testeroids.Assert;
public abstract class PrincipalContextFactorySpecs
{
public sealed class after_instantiating_Sut : SubjectInstantiationContextSpecification<PrincipalContextFactory>
{
#region Context
protected override sealed PrincipalContextFactory BecauseSutIsCreated()
{
return new PrincipalContextFactory();
}
#endregion
[Test]
public void then_Sut_is_instance_of_IPrincipalContextFactory()
{
Assert.IsInstanceOf<IPrincipalContextFactory>(this.Sut);
}
}
public abstract class given_instantiated_Sut : ContextSpecification<PrincipalContextFactory>
{
#region Context
protected override PrincipalContextFactory CreateSubjectUnderTest()
{
return new PrincipalContextFactory();
}
#endregion
[Category("Integration tests")]
[Ignore("Manual tests")]
public sealed class when_PrincipalContextFactory_is_used : given_instantiated_Sut
{
#region Context
protected override sealed void Because()
{
}
#endregion
[Test]
public void then_Result_matches_ExpectedResult()
{
try
{
var pcf = this.Sut;
var gpf = new GroupPrincipalFactory();
using (var pc = pcf.Create(ContextType.Domain, "lmbsvdc01.lmb.liebherr.i"))
{
var group = gpf.Create(pc, "LI-Lidia-Release");
group.Members.Add(pc, IdentityType.SamAccountName, "lgbbua0");
group.Save();
}
}
catch (System.DirectoryServices.DirectoryServicesCOMException)
{
//doSomething with E.Message.ToString();
}
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,96 @@
namespace SystemWrapper.Tests.Security.Certificate
// ReSharper disable InconsistentNaming
// ReSharper disable AccessToStaticMemberViaDerivedType
// ReSharper disable SealedMemberInSealedClass
{
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Security.Cryptography.Xml;
using SystemInterface.Security.Certificate;
using SystemWrapper.Security.Certificate;
using Moq;
using NUnit.Framework;
using Testeroids;
using Testeroids.Mocking;
public abstract class KeyInfoX509DataFactorySpecs
{
public abstract class given_instantiated_Sut : ContextSpecification<KeyInfoX509DataFactory>
{
#region Context
protected override KeyInfoX509DataFactory CreateSubjectUnderTest()
{
return new KeyInfoX509DataFactory();
}
#endregion
public sealed class when_Create_is_called : given_instantiated_Sut
{
#region Context
private string ExpectedSubject { get; set; }
private KeyInfoX509Data Result { get; set; }
private X509Certificate2 ReturnedGetCertificate { get; set; }
private ITesteroidsMock<IX509Certificate> SpecifiedCertificateMock { get; set; }
protected override void InstantiateMocks()
{
base.InstantiateMocks();
this.SpecifiedCertificateMock = this.MockRepository.CreateMock<IX509Certificate>();
}
protected override void EstablishContext()
{
base.EstablishContext();
var rawData = new byte[] { 48, 130, 3, 242, 48, 130, 2, 222, 160, 3, 2, 1, 2, 2, 1, 13, 48, 9, 6, 5, 43, 14, 3, 2, 29, 5, 0, 48, 76, 49, 11, 48, 9, 6, 3, 85, 4, 6, 19, 2, 68, 69, 49, 17, 48, 15, 6, 3, 85, 4, 10, 19, 8, 76, 105, 101, 98, 104, 101, 114, 114, 49, 17, 48, 15, 6, 3, 85, 4, 11, 19, 8, 90, 69, 68, 86, 45, 79, 82, 71, 49, 23, 48, 21, 6, 3, 85, 4, 3, 19, 14, 76, 105, 101, 98, 104, 101, 114, 114, 82, 111, 111, 116, 67, 65, 48, 30, 23, 13, 49, 49, 48, 54, 48, 57, 50, 51, 48, 48, 48, 48, 90, 23, 13, 49, 54, 48, 54, 48, 55, 50, 51, 48, 48, 48, 48, 90, 48, 129, 157, 49, 17, 48, 15, 6, 10, 9, 146, 38, 137, 147, 242, 44, 100, 1, 25, 22, 1, 105, 49, 24, 48, 22, 6, 10, 9, 146, 38, 137, 147, 242, 44, 100, 1, 25, 22, 8, 108, 105, 101, 98, 104, 101, 114, 114, 49, 19, 48, 17, 6, 10, 9, 146, 38, 137, 147, 242, 44, 100, 1, 25, 22, 3, 108, 109, 98, 49, 12, 48, 10, 6, 3, 85, 4, 11, 19, 3, 76, 77, 66, 49, 11, 48, 9, 6, 3, 85, 4, 11, 19, 2, 77, 68, 49, 12, 48, 10, 6, 3, 85, 4, 11, 19, 3, 77, 68, 52, 49, 19, 48, 17, 6, 3, 85, 4, 11, 19, 10, 68, 101, 118, 101, 108, 111, 112, 101, 114, 115, 49, 27, 48, 25, 6, 3, 85, 4, 3, 19, 18, 84, 117, 114, 104, 97, 108, 32, 72, 97, 115, 97, 110, 32, 40, 76, 77, 66, 41, 48, 130, 1, 34, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 1, 5, 0, 3, 130, 1, 15, 0, 48, 130, 1, 10, 2, 130, 1, 1, 0, 200, 13, 23, 165, 138, 234, 204, 241, 109, 213, 46, 126, 93, 107, 132, 146, 240, 51, 30, 178, 44, 80, 7, 180, 182, 106, 73, 110, 104, 147, 14, 241, 190, 151, 53, 80, 106, 78, 146, 228, 44, 166, 33, 236, 126, 11, 64, 27, 125, 192, 102, 125, 138, 196, 160, 255, 1, 174, 254, 190, 47, 135, 123, 132, 77, 213, 159, 183, 91, 206, 249, 60, 49, 177, 83, 218, 136, 118, 45, 238, 111, 138, 137, 202, 231, 151, 236, 243, 70, 166, 33, 199, 189, 154, 122, 120, 117, 53, 217, 201, 193, 84, 91, 26, 34, 62, 141, 61, 57, 21, 172, 250, 113, 128, 52, 148, 161, 172, 115, 177, 84, 205, 26, 139, 210, 242, 36, 19, 193, 184, 246, 179, 73, 199, 16, 235, 2, 86, 198, 236, 250, 93, 128, 99, 116, 149, 173, 64, 72, 20, 11, 46, 207, 239, 224, 29, 248, 210, 96, 204, 140, 116, 84, 1, 143, 192, 211, 255, 52, 174, 163, 178, 217, 64, 68, 90, 130, 8, 179, 216, 44, 111, 60, 33, 173, 196, 104, 57, 190, 78, 87, 243, 248, 30, 250, 248, 142, 223, 172, 65, 43, 33, 8, 120, 69, 48, 84, 224, 88, 93, 59, 229, 133, 40, 226, 199, 148, 175, 71, 161, 129, 36, 199, 245, 91, 56, 203, 198, 211, 197, 210, 3, 30, 224, 32, 67, 13, 16, 209, 30, 61, 226, 187, 66, 146, 180, 191, 78, 48, 202, 154, 112, 149, 236, 227, 29, 2, 3, 1, 0, 1, 163, 129, 148, 48, 129, 145, 48, 31, 6, 3, 85, 29, 37, 4, 24, 48, 22, 6, 10, 43, 6, 1, 4, 1, 130, 55, 10, 3, 12, 6, 8, 43, 6, 1, 5, 5, 7, 3, 2, 48, 110, 6, 3, 85, 29, 1, 4, 103, 48, 101, 128, 16, 123, 194, 115, 9, 48, 51, 13, 162, 36, 250, 205, 128, 106, 118, 52, 17, 161, 78, 48, 76, 49, 11, 48, 9, 6, 3, 85, 4, 6, 19, 2, 68, 69, 49, 17, 48, 15, 6, 3, 85, 4, 10, 19, 8, 76, 105, 101, 98, 104, 101, 114, 114, 49, 17, 48, 15, 6, 3, 85, 4, 11, 19, 8, 90, 69, 68, 86, 45, 79, 82, 71, 49, 23, 48, 21, 6, 3, 85, 4, 3, 19, 14, 76, 105, 101, 98, 104, 101, 114, 114, 82, 111, 111, 116, 67, 65, 130, 1, 5, 48, 9, 6, 5, 43, 14, 3, 2, 29, 5, 0, 3, 130, 1, 1, 0, 165, 132, 73, 202, 63, 104, 101, 39, 172, 118, 22, 208, 110, 179, 147, 26, 200, 215, 59, 182, 200, 152, 102, 175, 105, 196, 183, 136, 103, 191, 83, 223, 197, 131, 137, 48, 215, 213, 31, 27, 254, 215, 137, 48, 135, 20, 92, 246, 198, 104, 161, 4, 71, 5, 78, 203, 161, 116, 247, 217, 11, 119, 22, 169, 232, 238, 15, 254, 122, 17, 10, 161, 246, 223, 116, 152, 81, 10, 6, 190, 162, 63, 41, 240, 5, 184, 135, 37, 32, 141, 116, 249, 134, 113, 192, 151, 9, 245, 169, 15, 89, 210, 70, 235, 185, 180, 200, 146, 122, 94, 158, 202, 189, 29, 45, 198, 65, 173, 99, 112, 80, 155, 210, 46, 234, 175, 178, 212, 234, 119, 126, 83, 113, 57, 109, 155, 206, 127, 229, 119, 235, 224, 114, 51, 64, 38, 45, 194, 77, 193, 240, 81, 88, 80, 68, 175, 165, 71, 34, 91, 189, 242, 16, 104, 108, 13, 104, 8, 104, 201, 189, 235, 195, 106, 165, 58, 102, 185, 75, 34, 198, 112, 233, 129, 18, 119, 87, 72, 148, 137, 137, 137, 240, 157, 200, 6, 54, 167, 19, 224, 127, 254, 230, 220, 242, 242, 57, 87, 9, 204, 115, 32, 171, 90, 136, 144, 30, 56, 196, 27, 46, 194, 68, 22, 10, 216, 139, 10, 139, 12, 7, 204, 34, 240, 144, 23, 47, 32, 210, 27, 254, 123, 179, 2, 233, 230, 74, 103, 141, 11, 227, 4, 25, 249, 241, 129 };
this.ReturnedGetCertificate = new X509Certificate2(rawData);
this.SpecifiedCertificateMock
.Setup(o => o.GetCertificate())
.Returns(this.ReturnedGetCertificate)
.EnforceUsage();
this.ExpectedSubject = "CN=Turhal Hasan (LMB), OU=Developers, OU=MD4, OU=MD, OU=LMB, DC=lmb, DC=liebherr, DC=i";
}
protected override sealed void Because()
{
this.Result = this.Sut.Create(this.SpecifiedCertificateMock.Object);
}
#endregion
[Test]
public void then_GetCertificate_is_called_once_on_SpecifiedCertificateMock()
{
this.SpecifiedCertificateMock.Verify(o => o.GetCertificate(), Times.Once());
}
[Test]
public void then_Result_is_not_null()
{
Testeroids.Assert.IsNotNull(this.Result);
}
[Test]
public void then_Result_is_constructed_from_passed_certificate()
{
Testeroids.Assert.IsTrue(this.Result.Certificates.Cast<X509Certificate>().Any(cer => cer.Subject == this.ExpectedSubject));
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,84 @@
namespace SystemWrapper.Tests.Security.Certificate
// ReSharper disable InconsistentNaming
// ReSharper disable AccessToStaticMemberViaDerivedType
// ReSharper disable SealedMemberInSealedClass
{
using System.Security.Cryptography.X509Certificates;
using SystemInterface.Security.Certificate;
using SystemWrapper.Security.Certificate;
using NUnit.Framework;
using Testeroids;
public abstract class X509Certificate2CollectionFactorySpecs
{
public abstract class given_instantiated_Sut : ContextSpecification<X509Certificate2CollectionFactory>
{
#region Context
protected override X509Certificate2CollectionFactory CreateSubjectUnderTest()
{
return new X509Certificate2CollectionFactory();
}
#endregion
public sealed class when_Create_is_called_without_parameter : given_instantiated_Sut
{
#region Context
private IX509Certificate2Collection Result { get; set; }
protected override void EstablishContext()
{
base.EstablishContext();
}
protected override sealed void Because()
{
this.Result = this.Sut.Create();
}
#endregion
[Test]
public void then_Result_is_not_null()
{
Testeroids.Assert.NotNull(this.Result);
}
}
public sealed class when_Create_is_called_with_collection_parameter : given_instantiated_Sut
{
#region Context
private IX509Certificate2Collection Result { get; set; }
private X509Certificate2Collection SpecifiedCollection { get; set; }
protected override void EstablishContext()
{
base.EstablishContext();
this.SpecifiedCollection = new X509Certificate2Collection(new X509Certificate2());
}
protected override sealed void Because()
{
this.Result = this.Sut.Create(this.SpecifiedCollection);
}
#endregion
[Test]
public void then_Result_is_not_null()
{
Testeroids.Assert.NotNull(this.Result);
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,145 @@
namespace SystemWrapper.Tests.Security.Certificate
// ReSharper disable InconsistentNaming
// ReSharper disable AccessToStaticMemberViaDerivedType
// ReSharper disable SealedMemberInSealedClass
{
using System.Security.Cryptography.X509Certificates;
using SystemInterface.Security.Certificate;
using SystemWrapper.Security.Certificate;
using NUnit.Framework;
using Testeroids;
public abstract class X509ChainElementCollectionFactorySpecs
{
public abstract class given_instantiated_Sut : ContextSpecification<X509ChainElementCollectionFactory>
{
#region Context
protected override X509ChainElementCollectionFactory CreateSubjectUnderTest()
{
return new X509ChainElementCollectionFactory();
}
#endregion
public sealed class when_Create_is_called_without_parameter : given_instantiated_Sut
{
#region Context
private IX509ChainElementCollection Result { get; set; }
protected override void EstablishContext()
{
base.EstablishContext();
}
protected override sealed void Because()
{
this.Result = this.Sut.Create();
}
#endregion
[Test]
public void then_Result_is_not_null()
{
NUnit.Framework.Assert.NotNull(this.Result);
}
}
public sealed class when_Create_is_called : given_instantiated_Sut
{
#region Context
private static readonly byte[] LiebherrRootCaCertificateRawCertData =
{
0x30, 0x82, 0x03, 0x9a, 0x30, 0x82, 0x02, 0x82, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, 0x61, 0xf4, 0x7b, 0x45, 0x74, 0xf8,
0xc3, 0x9f, 0x4e, 0x0c, 0xed, 0xa8, 0x00, 0xda, 0x3d, 0xd3, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01,
0x01, 0x05, 0x05, 0x00, 0x30, 0x4c, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x44, 0x45, 0x31, 0x11,
0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x08, 0x4c, 0x69, 0x65, 0x62, 0x68, 0x65, 0x72, 0x72, 0x31, 0x11, 0x30, 0x0f,
0x06, 0x03, 0x55, 0x04, 0x0b, 0x13, 0x08, 0x5a, 0x45, 0x44, 0x56, 0x2d, 0x4f, 0x52, 0x47, 0x31, 0x17, 0x30, 0x15, 0x06, 0x03,
0x55, 0x04, 0x03, 0x13, 0x0e, 0x4c, 0x69, 0x65, 0x62, 0x68, 0x65, 0x72, 0x72, 0x52, 0x6f, 0x6f, 0x74, 0x43, 0x41, 0x30, 0x1e,
0x17, 0x0d, 0x30, 0x39, 0x31, 0x30, 0x32, 0x36, 0x31, 0x30, 0x30, 0x37, 0x34, 0x37, 0x5a, 0x17, 0x0d, 0x32, 0x39, 0x31, 0x30,
0x32, 0x36, 0x31, 0x30, 0x31, 0x37, 0x34, 0x37, 0x5a, 0x30, 0x4c, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13,
0x02, 0x44, 0x45, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x08, 0x4c, 0x69, 0x65, 0x62, 0x68, 0x65, 0x72,
0x72, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x13, 0x08, 0x5a, 0x45, 0x44, 0x56, 0x2d, 0x4f, 0x52, 0x47, 0x31,
0x17, 0x30, 0x15, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x0e, 0x4c, 0x69, 0x65, 0x62, 0x68, 0x65, 0x72, 0x72, 0x52, 0x6f, 0x6f,
0x74, 0x43, 0x41, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05,
0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xbf, 0x15, 0x9e, 0xde, 0xf7, 0xe7,
0x18, 0x89, 0x86, 0xc8, 0x20, 0xb8, 0x36, 0x42, 0x36, 0x02, 0x1c, 0xa8, 0x1c, 0x17, 0xe6, 0x09, 0x47, 0x48, 0xb1, 0xa8, 0x09,
0xd7, 0x36, 0x7c, 0xb3, 0x24, 0xb3, 0xd6, 0x25, 0xf6, 0x21, 0xc8, 0x02, 0xbc, 0x76, 0xd2, 0xf6, 0x7a, 0xbd, 0x46, 0x0b, 0xfc,
0xb1, 0x72, 0x5a, 0x5f, 0x89, 0xfe, 0xe2, 0x5e, 0xfb, 0xcd, 0x66, 0x46, 0xc3, 0x49, 0x4f, 0x47, 0xd5, 0xa8, 0x62, 0xb4, 0x37,
0x18, 0x24, 0x21, 0x32, 0x62, 0xfe, 0xaa, 0x20, 0xe4, 0x8b, 0xf8, 0x63, 0x00, 0x0d, 0xa1, 0x79, 0xb7, 0xa8, 0x69, 0xad, 0xf0,
0x54, 0x0a, 0xcb, 0x5d, 0x98, 0x2f, 0x4f, 0x6e, 0xe6, 0x6b, 0x04, 0xd9, 0xc3, 0xfc, 0xc3, 0x58, 0x21, 0x96, 0xca, 0xa7, 0x46,
0x12, 0xf2, 0x64, 0x4d, 0x2a, 0x6c, 0x25, 0x4d, 0x0e, 0x28, 0x37, 0x4c, 0x84, 0x2f, 0x6c, 0x16, 0x0f, 0xc9, 0x79, 0xce, 0x0c,
0x50, 0x7a, 0x33, 0xe3, 0x39, 0xdc, 0x91, 0x62, 0xd1, 0x44, 0x41, 0xee, 0xe4, 0x8f, 0x86, 0xab, 0xe1, 0x74, 0xe8, 0x05, 0xad,
0xd1, 0xa2, 0x11, 0x9f, 0x8b, 0x01, 0xe9, 0x80, 0xb9, 0x92, 0xe2, 0x04, 0x93, 0x04, 0x6a, 0xe7, 0xcd, 0x59, 0x9c, 0x46, 0xcc,
0x60, 0x18, 0x2e, 0x2a, 0x46, 0xd3, 0x52, 0xb3, 0xe0, 0x1f, 0x93, 0xb2, 0x77, 0x5a, 0x38, 0x8e, 0x78, 0x25, 0xaf, 0x88, 0xf3,
0x92, 0xdc, 0xe6, 0xae, 0x97, 0x07, 0x0f, 0x84, 0x2c, 0xbe, 0xfb, 0x65, 0x57, 0x95, 0x57, 0x37, 0x57, 0x2e, 0x56, 0x7a, 0xa6,
0xed, 0x7b, 0x13, 0x98, 0x1d, 0x3d, 0x59, 0x66, 0x5f, 0x58, 0x7a, 0xc7, 0x3c, 0x6a, 0xa5, 0xf0, 0xff, 0x23, 0x1c, 0x12, 0x0d,
0x80, 0x65, 0xe5, 0xc9, 0x8a, 0x8a, 0x0b, 0xb6, 0x7f, 0xe1, 0xc2, 0xeb, 0xe5, 0x19, 0x61, 0x9a, 0x64, 0x1c, 0x13, 0x02, 0x03,
0x01, 0x00, 0x01, 0xa3, 0x78, 0x30, 0x76, 0x30, 0x0b, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x04, 0x04, 0x03, 0x02, 0x01, 0x86, 0x30,
0x0f, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xff, 0x30, 0x1d, 0x06, 0x03, 0x55,
0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0x74, 0xe0, 0xc4, 0xfb, 0x95, 0xf2, 0x48, 0x78, 0x1a, 0x17, 0xe2, 0x14, 0xcb, 0xb0, 0x83,
0x03, 0xe8, 0xf9, 0xf7, 0xb5, 0x30, 0x12, 0x06, 0x09, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x15, 0x01, 0x04, 0x05, 0x02,
0x03, 0x02, 0x00, 0x02, 0x30, 0x23, 0x06, 0x09, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x15, 0x02, 0x04, 0x16, 0x04, 0x14,
0xef, 0x3c, 0x80, 0x54, 0x72, 0x15, 0x38, 0xe5, 0x3a, 0x16, 0xd4, 0x78, 0xe6, 0x05, 0x45, 0x6a, 0x46, 0x6a, 0x4f, 0x9f, 0x30,
0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0xaf, 0x22,
0x35, 0x04, 0x52, 0x7d, 0xf9, 0xc5, 0x8a, 0x77, 0x25, 0x5e, 0xcf, 0xeb, 0x01, 0x1e, 0x77, 0xa9, 0xb5, 0x79, 0x39, 0x3d, 0x07,
0x6e, 0xe4, 0x29, 0x7c, 0x10, 0xae, 0xf6, 0x3f, 0x02, 0x18, 0x57, 0xd4, 0xeb, 0x38, 0x0d, 0x69, 0xd9, 0x3b, 0x7a, 0x58, 0xb1,
0xb0, 0x53, 0x21, 0x78, 0x5e, 0x39, 0x0c, 0x8b, 0x5a, 0x30, 0x85, 0x5f, 0xe1, 0x87, 0xdf, 0xf9, 0xb8, 0x8e, 0xad, 0xf1, 0x12,
0x2e, 0xf3, 0xef, 0xba, 0x08, 0x2d, 0x6e, 0xba, 0xb4, 0x1a, 0xe1, 0x9a, 0x4c, 0xb9, 0xa7, 0xc9, 0x06, 0xe4, 0x21, 0x64, 0x7a,
0x75, 0xaf, 0x82, 0xb9, 0xcb, 0xe2, 0xcd, 0xdd, 0x45, 0x80, 0xb2, 0xb9, 0x19, 0xe2, 0xd2, 0xb1, 0xe9, 0x84, 0xec, 0xc8, 0xca,
0x0a, 0x06, 0xa3, 0x36, 0xfb, 0x64, 0xae, 0x4a, 0xc8, 0xe7, 0x80, 0xd6, 0x15, 0xa0, 0xa1, 0xa7, 0x89, 0x3b, 0x77, 0x3f, 0x3b,
0x3f, 0xb8, 0x84, 0x84, 0xd7, 0xc4, 0x15, 0xcb, 0x11, 0x59, 0x2f, 0xa9, 0x27, 0x50, 0xd9, 0xde, 0x16, 0x99, 0x78, 0xad, 0x87,
0xef, 0x40, 0x61, 0x71, 0x59, 0xc2, 0xd9, 0x1f, 0xa9, 0xa8, 0xee, 0xbc, 0xaf, 0x57, 0xe1, 0xb9, 0xfa, 0x51, 0xbf, 0x94, 0x59,
0x7a, 0x5e, 0x3a, 0x3b, 0xfe, 0x27, 0x9b, 0x52, 0x8b, 0x23, 0x50, 0xfa, 0x94, 0x4e, 0x37, 0x73, 0x0c, 0x5e, 0x48, 0x4c, 0x72,
0x16, 0xe1, 0xb4, 0x34, 0x37, 0x5d, 0x24, 0x9e, 0xba, 0xd6, 0x57, 0x50, 0xea, 0x86, 0x1a, 0x50, 0x82, 0x6a, 0xf8, 0x60, 0x59,
0x50, 0x72, 0xd4, 0xcb, 0xf9, 0xb5, 0x30, 0x5a, 0xf1, 0xc6, 0xb5, 0x0b, 0x11, 0x7f, 0x9f, 0xac, 0xde, 0x8c, 0xf3, 0x2b, 0xaa,
0xd5, 0xb2, 0x44, 0x81, 0x45, 0xf0, 0x75, 0xd8, 0x65, 0xfd, 0x1c, 0x03, 0xa3, 0x58, 0xa2, 0x22, 0xb8, 0x64, 0x33, 0x2d, 0x57,
0xe8, 0xc8
};
private int ExpectedCount { get; set; }
private IX509ChainElementCollection Result { get; set; }
private X509ChainElementCollection SpecifiedCollection { get; set; }
protected override void EstablishContext()
{
base.EstablishContext();
var collection = new X509Chain();
collection.Build(new X509Certificate2(LiebherrRootCaCertificateRawCertData));
this.SpecifiedCollection = collection.ChainElements;
this.ExpectedCount = 1;
}
protected override sealed void Because()
{
this.Result = this.Sut.Create(this.SpecifiedCollection);
}
#endregion
[Test]
public void then_Result_is_not_null()
{
NUnit.Framework.Assert.NotNull(this.Result);
}
[Test]
public void then_Result_Count_matches_ExpectedCount()
{
NUnit.Framework.Assert.AreEqual(this.ExpectedCount, this.Result.Count);
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,163 @@
namespace SystemWrapper.Tests.Security.Certificate
// ReSharper disable InconsistentNaming
// ReSharper disable AccessToStaticMemberViaDerivedType
// ReSharper disable SealedMemberInSealedClass
{
using System.Security.Cryptography.X509Certificates;
using SystemInterface.IO;
using SystemInterface.Security.Certificate;
using SystemWrapper.Security.Certificate;
using NUnit.Framework;
using Testeroids;
public abstract class X509ChainElementFactorySpecs
{
public abstract class given_instantiated_Sut : ContextSpecification<X509ChainElementFactory>
{
#region Context
private ITesteroidsMock<IFile> SpecifiedFileMock { get; set; }
private ITesteroidsMock<IPath> SpecifiedPathMock { get; set; }
protected override void InstantiateMocks()
{
base.InstantiateMocks();
this.SpecifiedFileMock = this.MockRepository.CreateMock<IFile>();
this.SpecifiedPathMock = this.MockRepository.CreateMock<IPath>();
}
protected override X509ChainElementFactory CreateSubjectUnderTest()
{
return new X509ChainElementFactory(
this.SpecifiedFileMock.Object,
this.SpecifiedPathMock.Object);
}
#endregion
public sealed class when_Create_is_called_without_parameter : given_instantiated_Sut
{
#region Context
private IX509ChainElement Result { get; set; }
protected override void EstablishContext()
{
base.EstablishContext();
}
protected override sealed void Because()
{
this.Result = this.Sut.Create();
}
#endregion
[Test]
public void then_Result_is_not_null()
{
Testeroids.Assert.NotNull(this.Result);
}
}
public sealed class when_Create_is_called : given_instantiated_Sut
{
#region Context
private static readonly byte[] LiebherrRootCaCertificateRawCertData =
{
0x30, 0x82, 0x03, 0x9a, 0x30, 0x82, 0x02, 0x82, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, 0x61, 0xf4, 0x7b, 0x45, 0x74, 0xf8,
0xc3, 0x9f, 0x4e, 0x0c, 0xed, 0xa8, 0x00, 0xda, 0x3d, 0xd3, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01,
0x01, 0x05, 0x05, 0x00, 0x30, 0x4c, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x44, 0x45, 0x31, 0x11,
0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x08, 0x4c, 0x69, 0x65, 0x62, 0x68, 0x65, 0x72, 0x72, 0x31, 0x11, 0x30, 0x0f,
0x06, 0x03, 0x55, 0x04, 0x0b, 0x13, 0x08, 0x5a, 0x45, 0x44, 0x56, 0x2d, 0x4f, 0x52, 0x47, 0x31, 0x17, 0x30, 0x15, 0x06, 0x03,
0x55, 0x04, 0x03, 0x13, 0x0e, 0x4c, 0x69, 0x65, 0x62, 0x68, 0x65, 0x72, 0x72, 0x52, 0x6f, 0x6f, 0x74, 0x43, 0x41, 0x30, 0x1e,
0x17, 0x0d, 0x30, 0x39, 0x31, 0x30, 0x32, 0x36, 0x31, 0x30, 0x30, 0x37, 0x34, 0x37, 0x5a, 0x17, 0x0d, 0x32, 0x39, 0x31, 0x30,
0x32, 0x36, 0x31, 0x30, 0x31, 0x37, 0x34, 0x37, 0x5a, 0x30, 0x4c, 0x31, 0x0b, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13,
0x02, 0x44, 0x45, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x0a, 0x13, 0x08, 0x4c, 0x69, 0x65, 0x62, 0x68, 0x65, 0x72,
0x72, 0x31, 0x11, 0x30, 0x0f, 0x06, 0x03, 0x55, 0x04, 0x0b, 0x13, 0x08, 0x5a, 0x45, 0x44, 0x56, 0x2d, 0x4f, 0x52, 0x47, 0x31,
0x17, 0x30, 0x15, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x0e, 0x4c, 0x69, 0x65, 0x62, 0x68, 0x65, 0x72, 0x72, 0x52, 0x6f, 0x6f,
0x74, 0x43, 0x41, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05,
0x00, 0x03, 0x82, 0x01, 0x0f, 0x00, 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xbf, 0x15, 0x9e, 0xde, 0xf7, 0xe7,
0x18, 0x89, 0x86, 0xc8, 0x20, 0xb8, 0x36, 0x42, 0x36, 0x02, 0x1c, 0xa8, 0x1c, 0x17, 0xe6, 0x09, 0x47, 0x48, 0xb1, 0xa8, 0x09,
0xd7, 0x36, 0x7c, 0xb3, 0x24, 0xb3, 0xd6, 0x25, 0xf6, 0x21, 0xc8, 0x02, 0xbc, 0x76, 0xd2, 0xf6, 0x7a, 0xbd, 0x46, 0x0b, 0xfc,
0xb1, 0x72, 0x5a, 0x5f, 0x89, 0xfe, 0xe2, 0x5e, 0xfb, 0xcd, 0x66, 0x46, 0xc3, 0x49, 0x4f, 0x47, 0xd5, 0xa8, 0x62, 0xb4, 0x37,
0x18, 0x24, 0x21, 0x32, 0x62, 0xfe, 0xaa, 0x20, 0xe4, 0x8b, 0xf8, 0x63, 0x00, 0x0d, 0xa1, 0x79, 0xb7, 0xa8, 0x69, 0xad, 0xf0,
0x54, 0x0a, 0xcb, 0x5d, 0x98, 0x2f, 0x4f, 0x6e, 0xe6, 0x6b, 0x04, 0xd9, 0xc3, 0xfc, 0xc3, 0x58, 0x21, 0x96, 0xca, 0xa7, 0x46,
0x12, 0xf2, 0x64, 0x4d, 0x2a, 0x6c, 0x25, 0x4d, 0x0e, 0x28, 0x37, 0x4c, 0x84, 0x2f, 0x6c, 0x16, 0x0f, 0xc9, 0x79, 0xce, 0x0c,
0x50, 0x7a, 0x33, 0xe3, 0x39, 0xdc, 0x91, 0x62, 0xd1, 0x44, 0x41, 0xee, 0xe4, 0x8f, 0x86, 0xab, 0xe1, 0x74, 0xe8, 0x05, 0xad,
0xd1, 0xa2, 0x11, 0x9f, 0x8b, 0x01, 0xe9, 0x80, 0xb9, 0x92, 0xe2, 0x04, 0x93, 0x04, 0x6a, 0xe7, 0xcd, 0x59, 0x9c, 0x46, 0xcc,
0x60, 0x18, 0x2e, 0x2a, 0x46, 0xd3, 0x52, 0xb3, 0xe0, 0x1f, 0x93, 0xb2, 0x77, 0x5a, 0x38, 0x8e, 0x78, 0x25, 0xaf, 0x88, 0xf3,
0x92, 0xdc, 0xe6, 0xae, 0x97, 0x07, 0x0f, 0x84, 0x2c, 0xbe, 0xfb, 0x65, 0x57, 0x95, 0x57, 0x37, 0x57, 0x2e, 0x56, 0x7a, 0xa6,
0xed, 0x7b, 0x13, 0x98, 0x1d, 0x3d, 0x59, 0x66, 0x5f, 0x58, 0x7a, 0xc7, 0x3c, 0x6a, 0xa5, 0xf0, 0xff, 0x23, 0x1c, 0x12, 0x0d,
0x80, 0x65, 0xe5, 0xc9, 0x8a, 0x8a, 0x0b, 0xb6, 0x7f, 0xe1, 0xc2, 0xeb, 0xe5, 0x19, 0x61, 0x9a, 0x64, 0x1c, 0x13, 0x02, 0x03,
0x01, 0x00, 0x01, 0xa3, 0x78, 0x30, 0x76, 0x30, 0x0b, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x04, 0x04, 0x03, 0x02, 0x01, 0x86, 0x30,
0x0f, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xff, 0x30, 0x1d, 0x06, 0x03, 0x55,
0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0x74, 0xe0, 0xc4, 0xfb, 0x95, 0xf2, 0x48, 0x78, 0x1a, 0x17, 0xe2, 0x14, 0xcb, 0xb0, 0x83,
0x03, 0xe8, 0xf9, 0xf7, 0xb5, 0x30, 0x12, 0x06, 0x09, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x15, 0x01, 0x04, 0x05, 0x02,
0x03, 0x02, 0x00, 0x02, 0x30, 0x23, 0x06, 0x09, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x15, 0x02, 0x04, 0x16, 0x04, 0x14,
0xef, 0x3c, 0x80, 0x54, 0x72, 0x15, 0x38, 0xe5, 0x3a, 0x16, 0xd4, 0x78, 0xe6, 0x05, 0x45, 0x6a, 0x46, 0x6a, 0x4f, 0x9f, 0x30,
0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x05, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0xaf, 0x22,
0x35, 0x04, 0x52, 0x7d, 0xf9, 0xc5, 0x8a, 0x77, 0x25, 0x5e, 0xcf, 0xeb, 0x01, 0x1e, 0x77, 0xa9, 0xb5, 0x79, 0x39, 0x3d, 0x07,
0x6e, 0xe4, 0x29, 0x7c, 0x10, 0xae, 0xf6, 0x3f, 0x02, 0x18, 0x57, 0xd4, 0xeb, 0x38, 0x0d, 0x69, 0xd9, 0x3b, 0x7a, 0x58, 0xb1,
0xb0, 0x53, 0x21, 0x78, 0x5e, 0x39, 0x0c, 0x8b, 0x5a, 0x30, 0x85, 0x5f, 0xe1, 0x87, 0xdf, 0xf9, 0xb8, 0x8e, 0xad, 0xf1, 0x12,
0x2e, 0xf3, 0xef, 0xba, 0x08, 0x2d, 0x6e, 0xba, 0xb4, 0x1a, 0xe1, 0x9a, 0x4c, 0xb9, 0xa7, 0xc9, 0x06, 0xe4, 0x21, 0x64, 0x7a,
0x75, 0xaf, 0x82, 0xb9, 0xcb, 0xe2, 0xcd, 0xdd, 0x45, 0x80, 0xb2, 0xb9, 0x19, 0xe2, 0xd2, 0xb1, 0xe9, 0x84, 0xec, 0xc8, 0xca,
0x0a, 0x06, 0xa3, 0x36, 0xfb, 0x64, 0xae, 0x4a, 0xc8, 0xe7, 0x80, 0xd6, 0x15, 0xa0, 0xa1, 0xa7, 0x89, 0x3b, 0x77, 0x3f, 0x3b,
0x3f, 0xb8, 0x84, 0x84, 0xd7, 0xc4, 0x15, 0xcb, 0x11, 0x59, 0x2f, 0xa9, 0x27, 0x50, 0xd9, 0xde, 0x16, 0x99, 0x78, 0xad, 0x87,
0xef, 0x40, 0x61, 0x71, 0x59, 0xc2, 0xd9, 0x1f, 0xa9, 0xa8, 0xee, 0xbc, 0xaf, 0x57, 0xe1, 0xb9, 0xfa, 0x51, 0xbf, 0x94, 0x59,
0x7a, 0x5e, 0x3a, 0x3b, 0xfe, 0x27, 0x9b, 0x52, 0x8b, 0x23, 0x50, 0xfa, 0x94, 0x4e, 0x37, 0x73, 0x0c, 0x5e, 0x48, 0x4c, 0x72,
0x16, 0xe1, 0xb4, 0x34, 0x37, 0x5d, 0x24, 0x9e, 0xba, 0xd6, 0x57, 0x50, 0xea, 0x86, 0x1a, 0x50, 0x82, 0x6a, 0xf8, 0x60, 0x59,
0x50, 0x72, 0xd4, 0xcb, 0xf9, 0xb5, 0x30, 0x5a, 0xf1, 0xc6, 0xb5, 0x0b, 0x11, 0x7f, 0x9f, 0xac, 0xde, 0x8c, 0xf3, 0x2b, 0xaa,
0xd5, 0xb2, 0x44, 0x81, 0x45, 0xf0, 0x75, 0xd8, 0x65, 0xfd, 0x1c, 0x03, 0xa3, 0x58, 0xa2, 0x22, 0xb8, 0x64, 0x33, 0x2d, 0x57,
0xe8, 0xc8
};
private string ExpectedSubject { get; set; }
private IX509ChainElement Result { get; set; }
private X509ChainElement SpecifiedElement { get; set; }
protected override void EstablishContext()
{
base.EstablishContext();
var collection = new X509Chain();
collection.Build(new X509Certificate2(LiebherrRootCaCertificateRawCertData));
this.SpecifiedElement = collection.ChainElements[0];
this.ExpectedSubject = "CN=LiebherrRootCA, OU=ZEDV-ORG, O=Liebherr, C=DE";
}
protected override sealed void Because()
{
this.Result = this.Sut.Create(this.SpecifiedElement);
}
#endregion
[Test]
public void then_Result_is_not_null()
{
Testeroids.Assert.NotNull(this.Result);
}
[Test]
public void then_Result_Subject_matches_ExpectedSubject()
{
Testeroids.Assert.AreEqual(this.ExpectedSubject, this.Result.Certificate.Subject);
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,53 @@
namespace SystemWrapper.Tests.Security.Certificate
// ReSharper disable InconsistentNaming
// ReSharper disable AccessToStaticMemberViaDerivedType
// ReSharper disable SealedMemberInSealedClass
{
using SystemInterface.Security.Certificate;
using SystemWrapper.Security.Certificate;
using NUnit.Framework;
using Testeroids;
public abstract class X509ChainFactorySpecs
{
public abstract class given_instantiated_Sut : ContextSpecification<X509ChainFactory>
{
#region Context
protected override X509ChainFactory CreateSubjectUnderTest()
{
return new X509ChainFactory();
}
#endregion
public sealed class when_Create_is_called : given_instantiated_Sut
{
#region Context
private IX509Chain Result { get; set; }
protected override void EstablishContext()
{
base.EstablishContext();
}
protected override sealed void Because()
{
this.Result = this.Sut.Create();
}
#endregion
[Test]
public void then_Result_is_not_null()
{
NUnit.Framework.Assert.NotNull(this.Result);
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,59 @@
namespace SystemWrapper.Tests.Security.Certificate
// ReSharper disable InconsistentNaming
// ReSharper disable AccessToStaticMemberViaDerivedType
// ReSharper disable SealedMemberInSealedClass
{
using System.Security.Cryptography.X509Certificates;
using SystemInterface.Security.Certificate;
using SystemWrapper.Security.Certificate;
using NUnit.Framework;
using Testeroids;
public abstract class X509StoreFactorySpecs
{
public abstract class given_instantiated_Sut : ContextSpecification<X509StoreFactory>
{
#region Context
protected override X509StoreFactory CreateSubjectUnderTest()
{
return new X509StoreFactory();
}
#endregion
public sealed class when_Create_is_called : given_instantiated_Sut
{
#region Context
private IX509Store Result { get; set; }
private StoreLocation SpecifiedStoreLocation { get; set; }
protected override void EstablishContext()
{
base.EstablishContext();
this.SpecifiedStoreLocation = StoreLocation.LocalMachine;
}
protected override sealed void Because()
{
this.Result = this.Sut.Create(this.SpecifiedStoreLocation);
}
#endregion
[Test]
public void then_Result_is_not_null()
{
NUnit.Framework.Assert.NotNull(this.Result);
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,26 @@
namespace SystemWrapper.ActiveDirectory.Contracts
{
/// <summary>
///
/// </summary>
public interface IGroupPrincipal
{
#region Public Properties
/// <summary>
///
/// </summary>
IPrincipalCollection Members { get; }
#endregion
#region Public Methods and Operators
/// <summary>
///
/// </summary>
void Save();
#endregion
}
}

Просмотреть файл

@ -0,0 +1,24 @@
namespace SystemWrapper.ActiveDirectory.Contracts
{
using System.DirectoryServices.AccountManagement;
/// <summary>
///
/// </summary>
public interface IPrincipalCollection
{
#region Public Methods and Operators
/// <summary>
///
/// </summary>
/// <param name="context"></param>
/// <param name="identityType"></param>
/// <param name="identityValue"></param>
void Add(IPrincipalContext context,
IdentityType identityType,
string identityValue);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,20 @@
namespace SystemWrapper.ActiveDirectory.Contracts
{
using System;
using System.DirectoryServices.AccountManagement;
/// <summary>
///
/// </summary>
public interface IPrincipalContext : IDisposable
{
#region Public Properties
/// <summary>
///
/// </summary>
PrincipalContext PrincipalContextInstance { get; }
#endregion
}
}

Просмотреть файл

@ -0,0 +1,21 @@
namespace SystemWrapper.ActiveDirectory.Contracts
{
using System.DirectoryServices.AccountManagement;
/// <summary>
///
/// </summary>
public interface IPrincipalContextFactory
{
#region Public Methods and Operators
/// <summary>
///
/// </summary>
/// <returns></returns>
IPrincipalContext Create(ContextType contextType,
string name);
#endregion
}
}

Просмотреть файл

@ -0,0 +1,24 @@
namespace SystemWrapper.ActiveDirectory
{
using SystemInterface.ActiveDirectory;
/// <summary>
///
/// </summary>
public class DirectoryEntryFactory : IDirectoryEntryFactory
{
#region Public Methods and Operators
/// <summary>
///
/// </summary>
/// <param name="forestGc"></param>
/// <returns></returns>
public IDirectoryEntry Create(string forestGc)
{
return new DirectoryEntryWrap(forestGc);
}
#endregion
}
}

Просмотреть файл

@ -0,0 +1,187 @@
namespace SystemWrapper.ActiveDirectory
{
using System;
using System.DirectoryServices;
using SystemInterface.ActiveDirectory;
/// <summary>
///
/// </summary>
public class DirectoryEntryWrap : IDirectoryEntry
{
#region Fields
private readonly DirectoryEntry directoryEntry;
#endregion
#region Constructors and Destructors
/// <summary>
///
/// </summary>
/// <param name="forestGc">
/// </param>
public DirectoryEntryWrap(string forestGc)
{
this.directoryEntry = new DirectoryEntry(forestGc);
}
/// <summary>
///
/// </summary>
/// <param name="directoryEntry">
/// </param>
public DirectoryEntryWrap(DirectoryEntry directoryEntry)
{
this.directoryEntry = directoryEntry;
}
#endregion
#region Public Properties
/// <summary>
///
/// </summary>
public AuthenticationTypes AuthenticationType
{
get
{
return this.directoryEntry.AuthenticationType;
}
}
/// <summary>
///
/// </summary>
/// <returns>
/// </returns>
public Guid Guid
{
get
{
return this.directoryEntry.Guid;
}
}
/// <summary>
///
/// </summary>
public string Name
{
get
{
return this.directoryEntry.Name;
}
}
/// <summary>
///
/// </summary>
public string NativeGuid
{
get
{
return this.directoryEntry.NativeGuid;
}
}
/// <summary>
///
/// </summary>
public string Password
{
set
{
this.directoryEntry.Password = value;
}
}
/// <summary>
///
/// </summary>
public string Path
{
get
{
return this.directoryEntry.Path;
}
}
/// <summary>
///
/// </summary>
public string SchemaClassName
{
get
{
return this.directoryEntry.SchemaClassName;
}
}
/// <summary>
///
/// </summary>
public string Username
{
get
{
return this.directoryEntry.Username;
}
}
#endregion
#region Public Methods and Operators
/// <summary>
///
/// </summary>
public void Close()
{
this.directoryEntry.Close();
}
/// <summary>
///
/// </summary>
/// <returns>
/// </returns>
public void CommitChanges()
{
this.directoryEntry.CommitChanges();
}
/// <summary>
///
/// </summary>
/// <returns>
/// </returns>
public void DeleteTree()
{
this.directoryEntry.DeleteTree();
}
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
/// </summary>
public void Dispose()
{
this.directoryEntry.Dispose();
}
/// <summary>
///
/// </summary>
/// <returns>
/// </returns>
public DirectoryEntry GetDirectoryEntry()
{
return this.directoryEntry;
}
#endregion
}
}

Просмотреть файл

@ -0,0 +1,32 @@
namespace SystemWrapper.ActiveDirectory
{
using SystemInterface.ActiveDirectory;
/// <summary>
///
/// </summary>
public class DirectorySearcherFactory : IDirectorySearcherFactory
{
#region Public Methods and Operators
/// <summary>
///
/// </summary>
/// <param name="directoryEntry">
/// </param>
/// <param name="pageSize">
/// </param>
/// <param name="sizeLimit">
/// </param>
/// <returns>
/// </returns>
public IDirectorySearcher Create(IDirectoryEntry directoryEntry,
int sizeLimit = 20,
int? pageSize = null)
{
return new DirectorySearcherWrap(directoryEntry, sizeLimit, pageSize);
}
#endregion
}
}

Просмотреть файл

@ -0,0 +1,165 @@
namespace SystemWrapper.ActiveDirectory
{
using System.Collections.Specialized;
using System.DirectoryServices;
using SystemInterface.ActiveDirectory;
/// <summary>
///
/// </summary>
public class DirectorySearcherWrap : IDirectorySearcher
{
#region Fields
private readonly DirectorySearcher directorySearcher;
#endregion
#region Constructors and Destructors
/// <summary>
///
/// </summary>
/// <param name="directoryEntry">
/// </param>
/// <param name="sizeLimit">
/// </param>
/// <param name="pageSize">
/// </param>
public DirectorySearcherWrap(IDirectoryEntry directoryEntry,
int sizeLimit,
int? pageSize)
{
this.directorySearcher = new DirectorySearcher(directoryEntry.GetDirectoryEntry())
{
SizeLimit = sizeLimit,
};
if (pageSize.HasValue)
{
this.directorySearcher.PageSize = pageSize.Value;
}
}
#endregion
#region Public Properties
/// <summary>
///
/// </summary>
public bool CacheResults
{
get
{
return this.directorySearcher.CacheResults;
}
set
{
this.directorySearcher.CacheResults = value;
}
}
/// <summary>
///
/// </summary>
public string Filter
{
get
{
return this.directorySearcher.Filter;
}
set
{
this.directorySearcher.Filter = value;
}
}
/// <summary>
///
/// </summary>
/// <returns>
/// </returns>
public int PageSize
{
get
{
return this.directorySearcher.PageSize;
}
set
{
this.directorySearcher.PageSize = value;
}
}
/// <summary>
///
/// </summary>
/// <returns>
/// </returns>
public StringCollection PropertiesToLoad
{
get
{
return this.directorySearcher.PropertiesToLoad;
}
}
/// <summary>
///
/// </summary>
public int SizeLimit
{
get
{
return this.directorySearcher.SizeLimit;
}
set
{
this.directorySearcher.SizeLimit = value;
}
}
#endregion
#region Public Methods and Operators
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
/// </summary>
public void Dispose()
{
this.directorySearcher.Dispose();
}
/// <summary>
///
/// </summary>
/// <returns>
/// </returns>
public ISearchResultCollection FindAll()
{
var searchResultCollection = this.directorySearcher.FindAll();
return new SearchResultCollectionWrap(searchResultCollection);
}
/// <summary>
///
/// </summary>
/// <returns>
/// </returns>
public ISearchResult FindOne()
{
var searchResult = this.directorySearcher.FindOne();
if (searchResult != null)
{
var searchResultWrap = new SearchResultWrap(searchResult);
return searchResultWrap;
}
return null;
}
#endregion
}
}

Просмотреть файл

@ -0,0 +1,69 @@
namespace SystemWrapper.ActiveDirectory
{
using System.DirectoryServices.AccountManagement;
using SystemWrapper.ActiveDirectory.Contracts;
/// <summary>
///
/// </summary>
public class GroupPrincipalWrap : IGroupPrincipal
{
#region Fields
private readonly GroupPrincipal groupPrincipal;
#endregion
#region Constructors and Destructors
/// <summary>
///
/// </summary>
public GroupPrincipalWrap(GroupPrincipal groupPrincipal)
{
this.groupPrincipal = groupPrincipal;
}
#endregion
#region Public Properties
/// <summary>
///
/// </summary>
public IPrincipalCollection Members
{
get
{
return new PrincipalCollectionWrap(this.groupPrincipal.Members);
}
}
#endregion
#region Public Methods and Operators
/// <summary>
///
/// </summary>
/// <param name="principalContext"></param>
/// <param name="groupName"></param>
/// <returns></returns>
public static IGroupPrincipal FindByIdentity(IPrincipalContext principalContext,
string groupName)
{
return new GroupPrincipalWrap(GroupPrincipal.FindByIdentity(principalContext.PrincipalContextInstance, groupName));
}
/// <summary>
///
/// </summary>
public void Save()
{
this.groupPrincipal.Save();
}
#endregion
}
}

Просмотреть файл

@ -0,0 +1,47 @@
namespace SystemWrapper.ActiveDirectory
{
using System.DirectoryServices.AccountManagement;
using SystemWrapper.ActiveDirectory.Contracts;
/// <summary>
///
/// </summary>
public class PrincipalCollectionWrap : IPrincipalCollection
{
#region Fields
private readonly PrincipalCollection principalCollection;
#endregion
#region Constructors and Destructors
/// <summary>
///
/// </summary>
public PrincipalCollectionWrap(PrincipalCollection principalCollection)
{
this.principalCollection = principalCollection;
}
#endregion
#region Public Methods and Operators
/// <summary>
///
/// </summary>
/// <param name="context"></param>
/// <param name="identityType"></param>
/// <param name="identityValue"></param>
public void Add(IPrincipalContext context,
IdentityType identityType,
string identityValue)
{
this.principalCollection.Add(context.PrincipalContextInstance, identityType, identityValue);
}
#endregion
}
}

Просмотреть файл

@ -0,0 +1,27 @@
namespace SystemWrapper.ActiveDirectory
{
using System.DirectoryServices.AccountManagement;
using SystemWrapper.ActiveDirectory.Contracts;
/// <summary>
///
/// </summary>
public class PrincipalContextFactory : IPrincipalContextFactory
{
#region Public Methods and Operators
/// <summary>
///
/// </summary>
/// <returns>
/// </returns>
public IPrincipalContext Create(ContextType contextType,
string name)
{
return new PrincipalContextWrap(contextType, name);
}
#endregion
}
}

Просмотреть файл

@ -0,0 +1,60 @@
namespace SystemWrapper.ActiveDirectory
{
using System.DirectoryServices.AccountManagement;
using SystemWrapper.ActiveDirectory.Contracts;
/// <summary>
///
/// </summary>
public class PrincipalContextWrap : IPrincipalContext
{
#region Fields
private readonly PrincipalContext principalContext;
#endregion
#region Constructors and Destructors
/// <summary>
///
/// </summary>
/// <param name="contextType"></param>
/// <param name="name"></param>
public PrincipalContextWrap(ContextType contextType,
string name)
{
this.principalContext = new PrincipalContext(contextType, name);
}
#endregion
#region Public Properties
/// <summary>
///
/// </summary>
public PrincipalContext PrincipalContextInstance
{
get
{
return this.principalContext;
}
}
#endregion
#region Public Methods and Operators
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
/// </summary>
public void Dispose()
{
this.principalContext.Dispose();
}
#endregion
}
}

Просмотреть файл

@ -0,0 +1,152 @@
namespace SystemWrapper.ActiveDirectory
{
using System;
using System.Collections;
using System.DirectoryServices;
using SystemInterface.ActiveDirectory;
/// <summary>
///
/// </summary>
public class ResultPropertyCollectionWrap : IResultPropertyCollection
{
#region Fields
private readonly ResultPropertyCollection resultPropertyCollection;
#endregion
#region Constructors and Destructors
/// <summary>
///
/// </summary>
/// <param name="resultPropertyCollection">
/// </param>
public ResultPropertyCollectionWrap(ResultPropertyCollection resultPropertyCollection)
{
this.resultPropertyCollection = resultPropertyCollection;
this.PropertyNames = this.resultPropertyCollection.PropertyNames;
this.Values = this.resultPropertyCollection.Values;
}
#endregion
#region Public Properties
/// <summary>
/// Gets the number of elements contained in the <see cref="T:System.Collections.ICollection"/>.
/// </summary>
/// <returns>
/// The number of elements contained in the <see cref="T:System.Collections.ICollection"/>.
/// </returns>
public int Count
{
get
{
return this.resultPropertyCollection.Count;
}
}
/// <summary>
/// Gets a value indicating whether access to the <see cref="T:System.Collections.ICollection"/> is synchronized (thread safe).
/// </summary>
/// <returns>
/// true if access to the <see cref="T:System.Collections.ICollection"/> is synchronized (thread safe); otherwise, false.
/// </returns>
public bool IsSynchronized
{
get
{
throw new NotImplementedException();
}
}
/// <summary>
/// Gets the names of the properties in this collection.
/// </summary>
public ICollection PropertyNames { get; private set; }
/// <summary>
/// Gets an object that can be used to synchronize access to the <see cref="T:System.Collections.ICollection"/>.
/// </summary>
/// <returns>
/// An object that can be used to synchronize access to the <see cref="T:System.Collections.ICollection"/>.
/// </returns>
public object SyncRoot
{
get
{
throw new NotImplementedException();
}
}
/// <summary>
/// Gets the values of the properties in this collection.
/// </summary>
public ICollection Values { get; private set; }
#endregion
#region Public Indexers
/// <summary>
/// Determines whether the property that has the specified name belongs to this
/// collection.
/// </summary>
/// <param name="name">
/// The name of the property to get.
/// </param>
public IResultPropertyValueCollection this[string name]
{
get
{
return new ResultPropertyValueCollectionWrap(this.resultPropertyCollection[name]);
}
}
#endregion
#region Public Methods and Operators
/// <summary>
/// Determines whether the property that has the specified name belongs to this
/// collection.
/// </summary>
/// <param name="propertyName">
/// The name of the property to find.
/// </param>
/// <returns>
/// The return value is true if the specified property belongs to this collection;
/// otherwise, false.
/// </returns>
public bool Contains(string propertyName)
{
return this.resultPropertyCollection.Contains(propertyName);
}
/// <summary>
/// Copies the elements of the <see cref="T:System.Collections.ICollection"/> to an <see cref="T:System.Array"/>, starting at a particular <see cref="T:System.Array"/> index.
/// </summary>
/// <param name="array">The one-dimensional <see cref="T:System.Array"/> that is the destination of the elements copied from <see cref="T:System.Collections.ICollection"/>. The <see cref="T:System.Array"/> must have zero-based indexing. </param><param name="index">The zero-based index in <paramref name="array"/> at which copying begins. </param><exception cref="T:System.ArgumentNullException"><paramref name="array"/> is null. </exception><exception cref="T:System.ArgumentOutOfRangeException"><paramref name="index"/> is less than zero. </exception><exception cref="T:System.ArgumentException"><paramref name="array"/> is multidimensional.-or- The number of elements in the source <see cref="T:System.Collections.ICollection"/> is greater than the available space from <paramref name="index"/> to the end of the destination <paramref name="array"/>. </exception><exception cref="T:System.ArgumentException">The type of the source <see cref="T:System.Collections.ICollection"/> cannot be cast automatically to the type of the destination <paramref name="array"/>. </exception>
public void CopyTo(Array array,
int index)
{
this.resultPropertyCollection.CopyTo(array, index);
}
/// <summary>
/// Returns an enumerator that iterates through a collection.
/// </summary>
/// <returns>
/// An <see cref="T:System.Collections.IEnumerator"/> object that can be used to iterate through the collection.
/// </returns>
public IEnumerator GetEnumerator()
{
return this.resultPropertyCollection.GetEnumerator();
}
#endregion
}
}

Просмотреть файл

@ -0,0 +1,174 @@
namespace SystemWrapper.ActiveDirectory
{
using System;
using System.Collections;
using System.DirectoryServices;
using System.Linq;
using SystemInterface.ActiveDirectory;
/// <summary>
///
/// </summary>
public class ResultPropertyValueCollectionWrap : IResultPropertyValueCollection
{
#region Fields
private readonly ResultPropertyValueCollection resultPropertyValueCollection;
#endregion
#region Constructors and Destructors
/// <summary>
///
/// </summary>
/// <param name="resultPropertyValueCollection">
/// </param>
public ResultPropertyValueCollectionWrap(ResultPropertyValueCollection resultPropertyValueCollection)
{
this.resultPropertyValueCollection = resultPropertyValueCollection;
}
#endregion
#region Public Properties
/// <summary>
/// Gets the number of elements contained in the <see cref="T:System.Collections.ICollection"/>.
/// </summary>
/// <returns>
/// The number of elements contained in the <see cref="T:System.Collections.ICollection"/>.
/// </returns>
public int Count
{
get
{
return this.resultPropertyValueCollection.Count;
}
}
/// <summary>
/// Gets a value indicating whether access to the <see cref="T:System.Collections.ICollection"/> is synchronized (thread safe).
/// </summary>
/// <returns>
/// true if access to the <see cref="T:System.Collections.ICollection"/> is synchronized (thread safe); otherwise, false.
/// </returns>
public bool IsSynchronized
{
get
{
throw new NotImplementedException();
}
}
/// <summary>
/// Gets an object that can be used to synchronize access to the <see cref="T:System.Collections.ICollection"/>.
/// </summary>
/// <returns>
/// An object that can be used to synchronize access to the <see cref="T:System.Collections.ICollection"/>.
/// </returns>
public object SyncRoot
{
get
{
throw new NotImplementedException();
}
}
#endregion
#region Public Indexers
/// <summary>
/// The System.DirectoryServices.ResultPropertyValueCollectionWrap.this[System.Int32]
/// property gets the property value that is located at a specified index.
/// </summary>
/// <param name="index">
/// The zero-based index of the property value to retrieve.
/// </param>
public object this[int index]
{
get
{
return this.resultPropertyValueCollection[index];
}
}
#endregion
#region Public Methods and Operators
/// <summary>
/// The System.DirectoryServices.ResultPropertyValueCollectionWrap.Contains(System.Object)
/// method determines whether a specified property value is in this collection.
/// </summary>
/// <param name="value">
/// The property value to find.
/// </param>
/// <returns>
/// The return value is true if the specified property belongs to this collection;
/// otherwise, false.
/// </returns>
public bool Contains(object value)
{
return this.resultPropertyValueCollection.Contains(value);
}
/// <summary>
/// The System.DirectoryServices.ResultPropertyValueCollectionWrap.CopyTo(System.Object[],System.Int32)
/// method copies the property values from this collection to an array, starting
/// at a particular index of the array.
/// </summary>
/// <param name="values">
/// An array of type System.Object that receives this collection's property values.
/// </param>
/// <param name="index">
/// The zero-based array index at which to begin copying the property values.
/// </param>
public void CopyTo(object[] values,
int index)
{
this.resultPropertyValueCollection.CopyTo(values, index);
}
/// <summary>
/// Copies the elements of the <see cref="T:System.Collections.ICollection"/> to an <see cref="T:System.Array"/>, starting at a particular <see cref="T:System.Array"/> index.
/// </summary>
/// <param name="array">The one-dimensional <see cref="T:System.Array"/> that is the destination of the elements copied from <see cref="T:System.Collections.ICollection"/>. The <see cref="T:System.Array"/> must have zero-based indexing. </param><param name="index">The zero-based index in <paramref name="array"/> at which copying begins. </param><exception cref="T:System.ArgumentNullException"><paramref name="array"/> is null. </exception><exception cref="T:System.ArgumentOutOfRangeException"><paramref name="index"/> is less than zero. </exception><exception cref="T:System.ArgumentException"><paramref name="array"/> is multidimensional.-or- The number of elements in the source <see cref="T:System.Collections.ICollection"/> is greater than the available space from <paramref name="index"/> to the end of the destination <paramref name="array"/>. </exception><exception cref="T:System.ArgumentException">The type of the source <see cref="T:System.Collections.ICollection"/> cannot be cast automatically to the type of the destination <paramref name="array"/>. </exception>
public void CopyTo(Array array,
int index)
{
this.resultPropertyValueCollection.CopyTo(array.Cast<object>().ToArray(), index);
}
/// <summary>
/// Returns an enumerator that iterates through a collection.
/// </summary>
/// <returns>
/// An <see cref="T:System.Collections.IEnumerator"/> object that can be used to iterate through the collection.
/// </returns>
public IEnumerator GetEnumerator()
{
return this.resultPropertyValueCollection.GetEnumerator();
}
/// <summary>
/// The System.DirectoryServices.ResultPropertyValueCollectionWrap.IndexOf(System.Object)
/// method retrieves the index of a specified property value in this collection.
/// </summary>
/// <param name="value">
/// The property value to find.
/// </param>
/// <returns>
/// The zero-based index of the specified property value. If the object is not
/// found, the return value is -1.
/// </returns>
public int IndexOf(object value)
{
return this.resultPropertyValueCollection.IndexOf(value);
}
#endregion
}
}

Просмотреть файл

@ -0,0 +1,194 @@
namespace SystemWrapper.ActiveDirectory
{
using System;
using System.Collections;
using System.Collections.Generic;
using System.DirectoryServices;
using SystemInterface.ActiveDirectory;
/// <summary>
///
/// </summary>
public class SearchResultCollectionWrap : ISearchResultCollection
{
#region Fields
private readonly SearchResultCollection searchResultCollection;
private readonly List<ISearchResult> searchResults;
#endregion
#region Constructors and Destructors
/// <summary>
///
/// </summary>
/// <param name="searchResultCollection">
/// </param>
public SearchResultCollectionWrap(SearchResultCollection searchResultCollection)
{
this.searchResultCollection = searchResultCollection;
this.searchResults = new List<ISearchResult>();
foreach (SearchResult searchResult in this.searchResultCollection)
{
this.searchResults.Add(new SearchResultWrap(searchResult));
}
}
#endregion
#region Public Properties
/// <summary>
/// Gets the number of elements contained in the <see cref="T:System.Collections.Generic.ICollection`1"/>.
/// </summary>
/// <returns>
/// The number of elements contained in the <see cref="T:System.Collections.Generic.ICollection`1"/>.
/// </returns>
public int Count
{
get
{
return this.searchResults.Count;
}
}
/// <summary>
/// Gets a value indicating whether the <see cref="T:System.Collections.Generic.ICollection`1"/> is read-only.
/// </summary>
/// <returns>
/// true if the <see cref="T:System.Collections.Generic.ICollection`1"/> is read-only; otherwise, false.
/// </returns>
public bool IsReadOnly
{
get
{
return true;
}
}
#endregion
#region Public Indexers
/// <summary>
///
/// </summary>
/// <param name="index">
/// </param>
/// <exception cref="InvalidOperationException">
/// </exception>
/// <exception cref="ArgumentOutOfRangeException">
/// </exception>
public ISearchResult this[int index]
{
get
{
if (index < 0)
{
throw new InvalidOperationException("Index must be greater or equal to zero");
}
if (index >= this.searchResults.Count)
{
throw new ArgumentOutOfRangeException("index", "Out of range.");
}
return this.searchResults[index];
}
}
#endregion
#region Public Methods and Operators
/// <summary>
/// Adds an item to the <see cref="T:System.Collections.Generic.ICollection`1"/>.
/// </summary>
/// <param name="item">The object to add to the <see cref="T:System.Collections.Generic.ICollection`1"/>.</param><exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.Generic.ICollection`1"/> is read-only.</exception>
public void Add(ISearchResult item)
{
this.searchResults.Add(item);
}
/// <summary>
/// Removes all items from the <see cref="T:System.Collections.Generic.ICollection`1"/>.
/// </summary>
/// <exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.Generic.ICollection`1"/> is read-only. </exception>
public void Clear()
{
this.searchResults.Clear();
}
/// <summary>
/// Determines whether the <see cref="T:System.Collections.Generic.ICollection`1"/> contains a specific value.
/// </summary>
/// <returns>
/// true if <paramref name="item"/> is found in the <see cref="T:System.Collections.Generic.ICollection`1"/>; otherwise, false.
/// </returns>
/// <param name="item">The object to locate in the <see cref="T:System.Collections.Generic.ICollection`1"/>.</param>
public bool Contains(ISearchResult item)
{
return this.searchResults.Contains(item);
}
/// <summary>
/// Copies the elements of the <see cref="T:System.Collections.Generic.ICollection`1"/> to an <see cref="T:System.Array"/>, starting at a particular <see cref="T:System.Array"/> index.
/// </summary>
public void CopyTo(ISearchResult[] array,
int arrayIndex)
{
this.searchResults.CopyTo(array, arrayIndex);
}
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
/// </summary>
public void Dispose()
{
this.searchResultCollection.Dispose();
}
/// <summary>
/// Returns an enumerator that iterates through the collection.
/// </summary>
/// <returns>
/// A <see cref="T:System.Collections.Generic.IEnumerator`1"/> that can be used to iterate through the collection.
/// </returns>
public IEnumerator<ISearchResult> GetEnumerator()
{
return this.searchResults.GetEnumerator();
}
/// <summary>
/// Removes the first occurrence of a specific object from the <see cref="T:System.Collections.Generic.ICollection`1"/>.
/// </summary>
/// <returns>
/// true if <paramref name="item"/> was successfully removed from the <see cref="T:System.Collections.Generic.ICollection`1"/>; otherwise, false. This method also returns false if <paramref name="item"/> is not found in the original <see cref="T:System.Collections.Generic.ICollection`1"/>.
/// </returns>
/// <param name="item">The object to remove from the <see cref="T:System.Collections.Generic.ICollection`1"/>.</param><exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.Generic.ICollection`1"/> is read-only.</exception>
public bool Remove(ISearchResult item)
{
return this.searchResults.Remove(item);
}
#endregion
#region Explicit Interface Methods
/// <summary>
/// Returns an enumerator that iterates through a collection.
/// </summary>
/// <returns>
/// An <see cref="T:System.Collections.IEnumerator"/> object that can be used to iterate through the collection.
/// </returns>
IEnumerator IEnumerable.GetEnumerator()
{
return this.GetEnumerator();
}
#endregion
}
}

Просмотреть файл

@ -0,0 +1,70 @@
namespace SystemWrapper.ActiveDirectory
{
using System.DirectoryServices;
using SystemInterface.ActiveDirectory;
/// <summary>
///
/// </summary>
public class SearchResultWrap : ISearchResult
{
#region Fields
private readonly SearchResult searchResult;
#endregion
#region Constructors and Destructors
/// <summary>
///
/// </summary>
/// <param name="searchResult">
/// </param>
public SearchResultWrap(SearchResult searchResult)
{
this.searchResult = searchResult;
}
#endregion
#region Public Properties
/// <summary>
///
/// </summary>
public IResultPropertyCollection Properties
{
get
{
var p = new ResultPropertyCollectionWrap(this.searchResult.Properties);
return p;
}
}
#endregion
#region Public Methods and Operators
/// <summary>
///
/// </summary>
/// <returns></returns>
public IDirectoryEntry GetDirectoryEntry()
{
return new DirectoryEntryWrap(this.searchResult.GetDirectoryEntry());
}
/// <summary>
///
/// </summary>
/// <returns></returns>
public SearchResult GetSearchResult()
{
return this.searchResult;
}
#endregion
}
}

Просмотреть файл

@ -0,0 +1,106 @@
namespace SystemWrapper.Collections.Specialized
{
using System.Collections;
using System.Collections.Specialized;
using SystemInterface.Collections.Specialized;
/// <summary>
/// Factory that creates a new <see cref="INameValueCollection"/> instance.
/// </summary>
public class NameValueCollectionFactory : INameValueCollectionFactory
{
#region Public Methods and Operators
/// <summary>
/// Creates a new <see cref="INameValueCollection"/> instance using the default constructor.
/// </summary>
/// <returns>
/// The <see cref="INameValueCollection"/>.
/// </returns>
public INameValueCollection Create()
{
return new NameValueCollectionWrap();
}
/// <summary>
/// Creates a new <see cref="INameValueCollection"/> instance passing the equality comparer.
/// </summary>
/// <param name="equalityComparer">
/// The equality comparer.
/// </param>
/// <returns>
/// The <see cref="INameValueCollection"/>.
/// </returns>
public INameValueCollection Create(IEqualityComparer equalityComparer)
{
return new NameValueCollectionWrap(equalityComparer);
}
/// <summary>
/// Creates a new <see cref="INameValueCollection"/> instance passing the name value collection.
/// </summary>
/// <param name="col">
/// The col.
/// </param>
/// <returns>
/// The <see cref="INameValueCollection"/>.
/// </returns>
public INameValueCollection Create(NameValueCollection col)
{
return new NameValueCollectionWrap(col);
}
/// <summary>
/// Creates a new <see cref="INameValueCollection"/> instance passing the capacity.
/// </summary>
/// <param name="capacity">
/// The capacity.
/// </param>
/// <returns>
/// The <see cref="INameValueCollection"/>.
/// </returns>
public INameValueCollection Create(int capacity)
{
return new NameValueCollectionWrap(capacity);
}
/// <summary>
/// Creates a new <see cref="INameValueCollection"/> instance passing the capacity and the equality comparer.
/// </summary>
/// <param name="capacity">
/// The capacity.
/// </param>
/// <param name="equalityComparer">
/// The equality comparer.
/// </param>
/// <returns>
/// The <see cref="INameValueCollection"/>.
/// </returns>
public INameValueCollection Create(int capacity,
IEqualityComparer equalityComparer)
{
return new NameValueCollectionWrap(capacity, equalityComparer);
}
/// <summary>
/// Creates a new <see cref="INameValueCollection"/> instance passing the capacity and the name value collection.
/// </summary>
/// <param name="capacity">
/// The capacity.
/// </param>
/// <param name="col">
/// The col.
/// </param>
/// <returns>
/// The <see cref="INameValueCollection"/>.
/// </returns>
public INameValueCollection Create(int capacity,
NameValueCollection col)
{
return new NameValueCollectionWrap(capacity, col);
}
#endregion
}
}

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше