|
/*
* Copyright (c) 2013, Yuriy Nelipovich
*
* If you find this code useful or in case of any questions, suggestions
* bug reports, donation, please email me: dev.yuriy.n@gmail.com
*/
using System.Configuration;
using System.Linq;
namespace LogJoin.Config
{
public class InputAttributes : ConfigurationElement
{
private const char ColumnNamesSeparator = ',';
[ConfigurationProperty("dirPath", IsRequired = true)]
public ConfigurationTextElement<string> DirPathElement
{
get { return (ConfigurationTextElement<string>) this["dirPath"]; }
set { this["dirPath"] = value; }
}
public string DirPath
{
get { return this.DirPathElement.Value; }
}
[ConfigurationProperty("fileName", IsRequired = true)]
public ConfigurationTextElement<string> FileNameMaskElement
{
get { return (ConfigurationTextElement<string>) this["fileName"]; }
set { this["fileName"] = value; }
}
public string FileNameMask
{
get { return this.FileNameMaskElement.Value; }
}
[ConfigurationProperty("name", IsRequired = true)]
public string SourceName
{
get { return (string) (this["name"]); }
set { this["name"] = value; }
}
[ConfigurationProperty("columns", IsRequired = true)]
public ConfigurationTextElement<string> ColumnNamesElement
{
get { return (ConfigurationTextElement<string>) this["columns"]; }
set { this["columns"] = value; }
}
public string[] ColumnNames
{
get
{
return this.ColumnNamesElement.Value
.Split(ColumnNamesSeparator)
.Select(s => s.Trim()).ToArray();
}
}
[ConfigurationProperty("regEx", IsRequired = true)]
public ConfigurationTextElement<string> RegExNameElement
{
get { return (ConfigurationTextElement<string>) this["regEx"]; }
set { this["regEx"] = value; }
}
public string RegExName
{
get { return this.RegExNameElement.Value; }
}
[ConfigurationProperty("key", IsRequired = true)]
public ConfigurationTextElement<string> KeyNamesElement
{
get { return (ConfigurationTextElement<string>) this["key"]; }
set { this["key"] = value; }
}
public string[] KeyNames
{
get
{
return this.KeyNamesElement.Value
.Split(ColumnNamesSeparator)
.Select(s => s.Trim()).ToArray();
}
}
[ConfigurationProperty("lines", IsRequired = false, DefaultValue = 1)]
public int MaxLinesCount
{
get { return (int) this["lines"]; }
set { this["lines"] = value; }
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.