private DataColumnCollection cols;\r
\r
public delegate bool Parser(ref string input, out object output);\r
- static private Dictionary<Type, Parser> parsers;\r
+ private static Dictionary<Type, Parser> parsers;\r
private Parser[] lineParser;\r
\r
#endregion\r
return null;\r
}\r
\r
+ public DataTable EstimateFormat(FilePath path)\r
+ {\r
+ DataTable table = new DataTable();\r
+ try\r
+ {\r
+ using (FileStream fs = new FileStream(\r
+ path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))\r
+ {\r
+ using (StreamReader reader = new StreamReader(fs))\r
+ {\r
+ while (reader.Peek() >= 0)\r
+ {\r
+ string line = reader.ReadLine();\r
+ // AnalyzeRow(line);\r
+ }\r
+ }\r
+ }\r
+ }\r
+ catch\r
+ { \r
+ }\r
+ return table;\r
+ }\r
+\r
public Parser GetParser(int column)\r
{\r
return lineParser[column];\r
return lineParser[prototype.Columns.IndexOf(column.ColumnName)];\r
}\r
\r
- static public Parser GetParser(Type type)\r
+ public static Parser GetParser(Type type)\r
{\r
return parsers[type];\r
}\r
lineParser[prototype.Columns.IndexOf(column.ColumnName)] = parser;\r
}\r
\r
- static public void SetParser(Type type, Parser parser)\r
+ public static void SetParser(Type type, Parser parser)\r
{\r
parsers[type] = parser;\r
}\r
\r
\r
-\r
#endregion\r
\r
#region private methods\r
}\r
}\r
\r
+ private void AnalyzeRow(string line)\r
+ {\r
+ while (line.Length > 0)\r
+ {\r
+ object value;\r
+ \r
+ //line = line.Substring(m.Length);\r
+ }\r
+ return;\r
+ }\r
+\r
#region parsers\r
\r
- static private bool ParseBoolean(ref string input, out object output)\r
+ private static bool ParseBoolean(ref string input, out object output)\r
{\r
Match m = Regex.Match(input, \r
"^" + Boolean.TrueString, RegexOptions.IgnoreCase);\r
return true;\r
}\r
\r
- static private bool ParseDouble(ref string input, out object output)\r
+ private static bool ParseDouble(ref string input, out object output)\r
{\r
Match m = RegexSet.DecimalFloat.Match(input);\r
if (!m.Success)\r
return true;\r
}\r
\r
- static private bool ParseSingle(ref string input, out object output)\r
+ private static bool ParseSingle(ref string input, out object output)\r
{\r
Match m = RegexSet.DecimalFloat.Match(input);\r
if (!m.Success)\r
return true;\r
}\r
\r
- static private bool ParseDecimal(ref string input, out object output)\r
+ private static bool ParseDecimal(ref string input, out object output)\r
{\r
Match m = RegexSet.DecimalFloat.Match(input);\r
if (!m.Success)\r
return true;\r
}\r
\r
- static private bool ParseInt32(ref string input, out object output)\r
+ private static bool ParseInt32(ref string input, out object output)\r
{\r
Match m = RegexSet.DecimalFloat.Match(input);\r
if (!m.Success)\r
return true;\r
}\r
\r
- static private bool ParseInt64(ref string input, out object output)\r
+ private static bool ParseInt64(ref string input, out object output)\r
{\r
Match m = RegexSet.DecimalFloat.Match(input);\r
if (!m.Success)\r