private static void selfTest() { selfTested = true; ass(new Formula("1e+2*1e-2").eval() == 1); ass(new Formula("1e2").eval() == 100); ass(new Formula("-./2").eval() == 0); ass(new Formula(".-2").eval() == -2); ass(new Formula(".e7/,5E5").eval() == 0); ass(new Formula(".5e7/-.5E5").eval() == -100); ass(new Formula("1e7/1e5").eval() == 100); ass(new Formula("3°2").eval() == 9); ass(new Formula("(3<2)^(5>4)").eval() == 1); ass(new Formula("3>2").eval() == 1); ass(new Formula("5<=2").eval() == 0); ass(new Formula("2+3* * *5").eval() == 47); //AttGetr: The operator "***" sqares the first and multiplies the result with the second. this operator is defined for testing and debugging purposes only ass(new Formula("!!3.14159").eval() == 1); ass(new Formula("!!0/12").eval() == 0); //ass(new Formula("2 - 1 1/2").eval() == .5); ass(Math.Abs(new Formula("0,5+sin(45*asin(1)/90)°2").eval() - 1) < 0.0000001); KeyPile <string, Reach> values = new KeyPile <string, Reach>(); values.Add("num", "4"); values.Add("x", "-1"); values.Add("n", "3"); //ass(Math.Abs(new Formula(" (((2 * num --sin(-.7x)) + 2°3°-(1/2)- 2n + 1 5/6) +--1/3n * 2 1/3 * - 3 1/2 + 5(+2n+1))/-3").eval(-1, values) + 10.5548125814992) < 0.0000000001); }
public void AddStart(int inx, long lbl) { if (useReachNotify) { return; } inx = inx + 1; store.Add(pack(inx, lbl), inx); store.Add(pack(0, lbl), inx); }
private void loadDbMru() { ctx cx = new ctx(); KeyPile <string, string> mruList = new KeyPile <string, string>(); for (long i = 1; i < 10; i++) { string val = ""; try { val = (string)(Registry.CurrentUser.CreateSubKey("SOFTWARE\\" + cx.Name + "\\DataBases").GetValue("MRU" + i)); } catch { val = ""; } if (val != null) { if (val.Length > 0) { mruList.Add("MRU" + i, val); } } } long j = 0; foreach (string key in mruList.kAsc) { j++; if (j > 9) { break; } pupMru.Items.Add(mruList[key]); } }
public Pile <Tag> tags(long maxDepth, params Pile <string>[] cond) { KeyPile <string, Pile <NamedValue <string, Tag> > > resSet = new KeyPile <string, Pile <NamedValue <string, Tag> > >(); KeyPile <string, Conditions> condsSet = new KeyPile <string, Conditions>(); condsSet.Add("", new Conditions("", "", "*", cond)); //if (resSet.Count == 0) resSet.Add("base", new Pile<Tag>()); return(tags(maxDepth, 1, condsSet, resSet)); }
// Definition: Labes and Indexes are positive int - Values - NOT positive long Values!!! (only 1 to 2147483647 are valid values for Labels and Indexes, 0 is neither a valid index nor is it a valid label!) // // For convenience all END-Labels and all END-Indexes are stores as negative int. // All START-Labels and all START-Indexes are stored as positive int. // The InxLblMap may contain the following types of entries: // 1.) StartIndex and StartLabel e.g key = (17, 2), value = 17 // 2.) EndIndex and EndLabel e.g key = (-33, -5), value = -33 // 3.) Zero and StartLabel e.g key = (0, 4) value = 18 // 4.) Zero and EndLabel e.g key = (0, -4) value = -40 // // Thus every Index/label pair is unique. // The List may contain (33, 5)/33 and (33, 7)/33 and (33, 9)/33 so there may be several Labels fot the Index 33. // But there may be only 1 Index for a specific Label! // There may be several Label entries for the same Index but there may be only ONE Index for a specific Label!!! public void AddStart(long inx, long lbl) { if (useReachNotify) { return; } inx = inx + 1; store.Add(((0L + (int)inx) << 32) | ((-2147483648L + (int)lbl) & 0xFFFFFFFF), inx); store.Add(((0L) << 32) | ((-2147483648L + (int)lbl) & 0xFFFFFFFF), inx); }
public string SourceCode(string name, long type) { Reach cSharp = new Reach(""); cSharp = cSharp + new Reach("\n"); cSharp = cSharp + new Reach("\n"); cSharp = cSharp + new Reach("/**\n"); cSharp = cSharp + new Reach(" *\n"); cSharp = cSharp + new Reach(" * generated source code, do not change\n"); cSharp = cSharp + new Reach(" */\n"); cSharp = cSharp + new Reach("\n"); cSharp = cSharp + new Reach("using System;\n"); cSharp = cSharp + new Reach("using System.Collections.Generic;\n"); cSharp = cSharp + new Reach("using System.Linq;\n"); cSharp = cSharp + new Reach("using System.Text;\n"); cSharp = cSharp + new Reach("\n"); cSharp = cSharp + new Reach("using ndBase;\n"); cSharp = cSharp + new Reach("using ndString;\n"); cSharp = cSharp + new Reach("using ndData;\n"); cSharp = cSharp + new Reach("using ndUdf;\n"); cSharp = cSharp + new Reach("\n"); cSharp = cSharp + new Reach("public class " + name + "Call\n"); cSharp = cSharp + new Reach("{\n"); cSharp = cSharp + new Reach(" private static string parserName = \"" + name + "\";\n"); cSharp = cSharp + new Reach(" private static bool tested = false;\n"); cSharp = cSharp + new Reach(" private UdfDisp Udf = null;\n"); cSharp = cSharp + new Reach("\n"); Reach Java = new Reach(""); Java = Java + new Reach("\n"); Java = Java + new Reach("\n"); Java = Java + new Reach("/**\n"); Java = Java + new Reach(" *\n"); Java = Java + new Reach(" * generated source code, do not change\n"); Java = Java + new Reach(" */\n"); Java = Java + new Reach("import org.getr.ndBase.Pile;\n"); Java = Java + new Reach("import org.getr.ndString.Reach;\n"); Java = Java + new Reach("import org.getr.ndData.Tag;\n"); Java = Java + new Reach("\n"); Java = Java + new Reach("public class " + name + "Call\n"); Java = Java + new Reach("{\n"); Java = Java + new Reach("\n"); Java = Java + new Reach(" private static String parserName = \"" + name + "\";\n"); Java = Java + new Reach(" private static boolean tested = false;\n"); Java = Java + new Reach(" private UdfDisp Udf = null;\n"); Java = Java + new Reach("\n"); Tag def = new Tag(GetParser(name, 0), true); Tag requestDef = def.tags(2, new Pile <string>("", true, "[type]==request"))[1]; Tag parserDef = def.tags(2, new Pile <string>("", true, "[type]==parser"))[1]; Tag responseDef = def.tags(2, new Pile <string>("", true, "[type]==response"))[1]; KeyPile <string, Reach> rqParams = new KeyPile <string, Reach>(); KeyPile <string, Reach> rpParams = new KeyPile <string, Reach>(); long ctr = 0; while (true) { Pile <Tag> found = requestDef.tags(1, new Pile <string>("", true, "[type]==param"), new Pile <string>("", true, "key==" + (++ctr) + "")); if (found.Len == 0) { break; } Tag paramTag = found[1]; string key = paramTag.txt.after(1, "[").before(1, "]").text; string test = ""; if (paramTag.attr.hasKey("test")) { test = paramTag.attr["test"].Value; } rqParams.Add(key, test); } foreach (Tag t in responseDef.tags(1, new Pile <string>("", true, "[type]==param"))) { string key = t.attr["name"].Value; string test = ""; if (t.attr.hasKey("test")) { test = t.attr["test"].Value; } rpParams.Add(key, test); } foreach (string paramName in rpParams.Keys) { cSharp = cSharp + new Reach(" private Reach m_" + Proper(paramName) + ";\n"); Java = Java + new Reach(" private Reach m_" + Proper(paramName) + ";\n"); } cSharp = cSharp + new Reach("\n"); Java = Java + new Reach("\n"); foreach (string paramName in rpParams.Keys) { cSharp = cSharp + new Reach(" public Reach " + Proper(paramName) + " { get { return m_" + Proper(paramName) + "; } }\n"); Java = Java + new Reach(" public Reach get" + Proper(paramName) + " () { return m_" + Proper(paramName) + "; }\n"); } cSharp = cSharp + new Reach("\n"); Java = Java + new Reach("\n"); cSharp = cSharp + new Reach(" public " + name + "Call(UdfDisp Udf)\n"); Java = Java + new Reach(" public " + name + "Call(UdfDisp Udf) throws Exception\n"); cSharp = cSharp + new Reach(" {\n"); Java = Java + new Reach(" {\n"); cSharp = cSharp + new Reach(" this.Udf = Udf;\n"); Java = Java + new Reach(" this.Udf = Udf;\n"); cSharp = cSharp + new Reach(" if (!tested)\n"); Java = Java + new Reach(" if (!tested)\n"); cSharp = cSharp + new Reach(" {\n"); Java = Java + new Reach(" {\n"); cSharp = cSharp + new Reach(" tested = true;\n"); Java = Java + new Reach(" tested = true;\n"); string testParams = ""; foreach (string paramName in rpParams.Keys) { testParams += rpParams[paramName].text; } if (testParams.Length == 0) { cSharp = cSharp + new Reach(" }\n"); Java = Java + new Reach(" }\n"); } else { foreach (string paramName in rpParams.Keys) { cSharp = cSharp + new Reach(" bool p_" + Proper(paramName) + " = false;\n"); Java = Java + new Reach(" boolean p_" + Proper(paramName) + " = false;\n"); } Reach execParams = new Reach(""); foreach (Reach test in rqParams) { execParams += new Reach("\"") + test + new Reach("\", "); } execParams = execParams.upto(-3); cSharp = cSharp + new Reach(" foreach (" + name + "Call res in exec( " + execParams.text + "))\n"); Java = Java + new Reach(" for (" + name + "Call res : exec( " + execParams.text + "))\n"); cSharp = cSharp + new Reach(" {\n"); Java = Java + new Reach(" {\n"); string passedCondition = ""; foreach (string paramName in rpParams.Keys) { string test = rpParams[paramName].text; passedCondition += " && p_" + Proper(paramName); cSharp = cSharp + new Reach(" if (res." + Proper(paramName) + ".Equals(\"" + test + "\")) p_" + Proper(paramName) + " = true;\n"); Java = Java + new Reach(" if (res.get" + Proper(paramName) + "().Equals(\"" + test + "\")) p_" + Proper(paramName) + " = true;\n"); } passedCondition = "(!(" + passedCondition.Substring(4) + "))"; cSharp = cSharp + new Reach(" }\n"); Java = Java + new Reach(" }\n"); cSharp = cSharp + new Reach(" if " + passedCondition + " throw new Exception(\"" + name + "Call selfTest FAILED! Check test values in " + name + ".xml against the WebPage you get from the url! (has the html structure changed?)\");\n"); Java = Java + new Reach(" if " + passedCondition + " throw new Exception(\"" + name + "Call selfTest FAILED! Check test values in " + name + ".xml against the WebPage you get from the url! (has the html structure changed?)\");\n"); cSharp = cSharp + new Reach(" }\n"); Java = Java + new Reach(" }\n"); } cSharp = cSharp + new Reach(" }\n"); Java = Java + new Reach(" }\n"); cSharp = cSharp + new Reach("\n"); Java = Java + new Reach("\n"); Reach cSharpParams = new Reach(""); Reach javaParams = new Reach(""); foreach (string key in rqParams.Keys) { cSharpParams += new Reach("string ") + key + new Reach(", "); javaParams += new Reach("String ") + key + new Reach(", "); } cSharpParams = cSharpParams.upto(-3); javaParams = javaParams.upto(-3); cSharp = cSharp + new Reach(" public Pile<" + name + "Call> exec(" + cSharpParams + ")\n"); Java = Java + new Reach(" public Pile<" + name + "Call> exec(" + javaParams + ") throws Exception\n"); cSharp = cSharp + new Reach(" {\n"); Java = Java + new Reach(" {\n"); cSharp = cSharp + new Reach(" string callParams = \"\";\n"); Java = Java + new Reach(" String callParams = \"\";\n"); foreach (string key in rqParams.Keys) { cSharp = cSharp + new Reach(" callParams += \"<param name=\\\"" + key + "\\\" value=\\\"\" + " + key + " + \"\\\"/>\";\n"); Java = Java + new Reach(" callParams += \"<param name=\\\"" + key + "\\\" value=\\\"\" + " + key + " + \"\\\"/>\";\n"); } cSharp = cSharp + new Reach(" Tag result = new Tag(Udf.Exec(parserName, callParams), true);\n"); Java = Java + new Reach(" Tag result = new Tag(Udf.exec(parserName, callParams), true);\n"); cSharp = cSharp + new Reach(" Pile<" + name + "Call> ret = new Pile<" + name + "Call>(0);\n"); Java = Java + new Reach(" Pile<" + name + "Call> ret = new Pile<" + name + "Call>(0);\n"); cSharp = cSharp + new Reach(" ret.Name = result.struc(-1);\n"); Java = Java + new Reach(" ret.setName(result.struc(-1));\n"); cSharp = cSharp + new Reach(" foreach (Tag tr in result.tags(1, new Pile<string>(\"\", \"[type]==tr\")))\n"); Java = Java + new Reach(" for (Tag tr : result.tags(1, new Pile<String>(\"\", \"[type]==tr\")))\n"); cSharp = cSharp + new Reach(" {\n"); Java = Java + new Reach(" {\n"); cSharp = cSharp + new Reach(" " + name + "Call res = new " + name + "Call(Udf);\n"); Java = Java + new Reach(" " + name + "Call res = new " + name + "Call(Udf);\n"); long rpCtr = 0; foreach (string key in rpParams.Keys) { rpCtr++; cSharp = cSharp + new Reach(" res.m_" + Proper(key) + " = tr.Tags[" + rpCtr + "].txt;\n"); Java = Java + new Reach(" res.m_" + Proper(key) + " = tr.Tags().get(" + rpCtr + ").txt();\n"); } cSharp = cSharp + new Reach(" ret.Add(res);\n"); Java = Java + new Reach(" ret.add(res);\n"); cSharp = cSharp + new Reach(" }\n"); Java = Java + new Reach(" }\n"); cSharp = cSharp + new Reach(" return ret;\n"); Java = Java + new Reach(" return ret;\n"); cSharp = cSharp + new Reach(" }\n"); Java = Java + new Reach(" }\n"); cSharp = cSharp + new Reach("}\n"); Java = Java + new Reach("}\n"); cSharp = cSharp + new Reach("\n"); Java = Java + new Reach("\n"); cSharp = cSharp + new Reach("\n"); Java = Java + new Reach("\n"); cSharp = cSharp + new Reach("\n"); Java = Java + new Reach("\n"); switch (type) { case 1: return(cSharp.text); case 2: return(Java.text); } return(""); }
public string Exec(string name, string param) { string ret = ""; string debug = ""; Tag debugDef = null; try { debugDef = new Tag(param, true).tags(2, Tag.where ("[type]==debug"))[1]; } catch (Exception ex) { } if (debugDef != null) { debug = debugDef.attr["name"].Value; } KeyPile <string, Tag> paramSet = new KeyPile <string, Tag>(); //Dictionary<string, Tag> paramSet = new Dictionary<string, Tag>(); Pile <Tag> rsDefSet = new Pile <Tag>(); KeyPile <string, Conditions> rsCondSet = new KeyPile <string, Conditions>(); KeyPile <string, Tag> responseSet = new KeyPile <string, Tag>(); //Dictionary<string, Tag> responseSet = new Dictionary<string, Tag>(); KeyPile <string, Tag> results = new KeyPile <string, Tag>(); KeyPile <string, Pile <NamedValue <string, Tag> > > resSet = new KeyPile <string, Pile <NamedValue <string, Tag> > >(); string url = prepare(name, param, paramSet, rsDefSet, rsCondSet, responseSet, results, debug); Pile <NamedValue <string, Tag> > baseSet = new Pile <NamedValue <string, Tag> >(); foreach (Tag t in results[1].Tags) { baseSet.Add(new NamedValue <string, Tag>("base:" + (baseSet.Len + 1), t)); } resSet.Add("base", baseSet); results[1].tags(-1, 1, rsCondSet, resSet); ret += "<tr>\n<td>" + (++execCounter) + "</td></tr>\n"; foreach (NamedValue <string, Tag> nt in resSet[-1]) { ret += "<tr>\n"; if (debug.Length == 0) { foreach (Tag rDef in responseSet) { Reach val; Reach valDef = rDef.attr["value"].Value.text.Replace("<", "<").Replace(">", ">").ToLower(); Reach delim = valDef.at(1, "."); if ((delim.len > 0) && (!valDef.before(delim).Equals(resSet.Keys[-1]))) { NamedValue <string, Tag> baseTag = nt; while (true) { Reach baseName = (Reach)baseTag.Name; int num = Int32.Parse(baseName.after(1, ":")); baseTag = resSet[baseName.before(1, ":")][num]; if (baseName.before(1, ":").Equals(valDef.before(delim))) { val = baseTag.Value.val(valDef.after(delim)); break; } } } else if (delim.len > 0) { val = nt.Value.val(valDef.after(delim)); } else { val = nt.Value.val(valDef); } ret += " <td>" + val.text.Replace("\n", "").Replace("\r", "") + " </td>\n"; } ret += "</tr>\n"; } else { ret += nt.Value.struc(-1) + "</tr>\n"; } } return("<url>" + url + "</url>" + ret); }
private string prepare(string name, string param, KeyPile <string, Tag> paramSet, Pile <Tag> rsDefSet, KeyPile <string, Conditions> rsCondSet, KeyPile <string, Tag> responseSet, KeyPile <string, Tag> results, string debug) { Tag def = new Tag(GetParser(name, 0), true); Tag requestDef = def.tags(2, new Pile <string>("", true, "[type]==request"))[1]; Tag parserDef = def.tags(2, new Pile <string>("", true, "[type]==parser"))[1]; Tag responseDef = def.tags(2, new Pile <string>("", true, "[type]==response"))[1]; KeyPile <string, Tag> resultSetDefinitions = new KeyPile <string, Tag>(); string url = parserDef.tags(2, Tag.where ("[type]==url"))[1].txt; foreach (Tag t in parserDef.tags(2, Tag.where ("[type]==resultset"))) { resultSetDefinitions.Add(t.attr["name"].Value.text, t); } foreach (string key in resultSetDefinitions.Keys) { rsDefSet.Add(resultSetDefinitions[key]); } foreach (Tag t in responseDef.tags(2, Tag.where ("[type]==param"))) { responseSet.Add(t.attr["name"].Value.text, t); } KeyPile <long, Tag> paramList = new KeyPile <long, Tag>(); foreach (Tag t in requestDef.tags(2, Tag.where ("[type]==param"))) { paramList.Add(Int32.Parse(t.attr["key"].Value.text), t); } foreach (long key in paramList.kAsc) { paramSet.Add(paramList[key].txt.after(1, "[").before(1, "]").text, paramList[key]); } Pile <Tag> qParams = new Tag(param, true).tags(2, Tag.where ("[type]==param")); string[] qp = new string[qParams.Len]; for (int i = 1; i <= qParams.Len; i++) { Tag t = qParams[i]; qp[i - 1] = t.attr["name"].Value.text + "=" + t.attr["value"].Value.text; } foreach (string worddef in qp) { string word = worddef; string key = utl.cutl(ref word, "="); long pos = 0; for (int i = 1; i <= paramSet.Len; i++) { if (paramSet.Keys[i].Equals(key)) { pos = i; break; } } url = url.Replace("[" + pos + "]", paramSet[key].txt.text.Replace("[" + key + "]", word)); } url = url.Replace("&", "&"); for (long i = 1; i <= paramSet.Len; i++) { url = url.Replace("[" + i + "]", ""); } for (int rset = 1; rset <= rsDefSet.Len; rset++) { if (debug.Equals("base")) { break; } Tag rsDef = rsDefSet[rset]; Pile <Pile <string> > rsFilters = new Pile <Pile <string> >(); foreach (Tag filterDef in rsDef.tags(2, Tag.where ("[type]==filter"))) { Pile <string> rsPatterns = new Pile <string>(); foreach (Tag patternDef in filterDef.tags(2, Tag.where ("[type]==pattern"))) { bool neg = patternDef.attr["neg"].Value.Equals("1"); bool csens = patternDef.attr["csens"].Value.Equals("1"); bool rexp = patternDef.attr["rexp"].Value.Equals("1"); string key = patternDef.attr["key"].Value.text.Replace(">", ">").Replace("<", "<"); string val = patternDef.txt; string cmp = ""; if (neg) { cmp = "!"; } if (!csens) { cmp += "°"; } if (rexp) { cmp += "~"; } else { cmp += "="; } if (csens) { cmp += cmp.Substring(cmp.Length - 1); } rsPatterns.Add(key + cmp + val); } rsFilters.Add(rsPatterns); } rsCondSet.Add(rsDef.attr["base"].Value + "-" + rsDef.attr["name"].Value, new Conditions(rsDef.attr["base"].Value, rsDef.attr["name"].Value, rsDef.tags(2, Tag.where ("[type]==sequence"))[1].attr["include"].Value.text.Trim(), rsFilters)); if (debug.Equals(rsDef.attr["name"].Value)) { break; } //rsCondSet.Add(rsDef.attr["base"].Item, new Conditions(rsDef.attr["base"].Item, rsDef.attr["name"].Item, rsDef.tags(2, Tag.where("[type]==sequence"))[1].attr["include"].Item.text.Trim(), rsFilters)); } //long Pos1 = ((string)Reach.Load("http://www.livejasmin.com/listpage.php?page=22&livejasmin_session=4678d6bb9242e4bef687d240c293b873&tags=girl&type=40&orderby=0")).IndexOf("allonline_perfnametext"); Tag doc = new Tag(Reach.Load(url), false); //long Pos2 = doc.struc(-1).IndexOf("allonline_perfnametext"); //for (long i = 1; i <= doc.Tags.Len(); i++) doc.Tags[i].Name = "base:" + i; results.Add("base", doc); return(url); }
internal Pile <Tag> tags(long maxDepth, long level, KeyPile <string, Conditions> condsSet, KeyPile <string, Pile <NamedValue <string, Tag> > > resSet) { long foundInThisLevel = 0; if (resSet.Len > 0) { if ((resSet.Len != condsSet.Len + 1)) { foreach (Conditions cnd in condsSet) { resSet.Add(cnd.name, new Pile <NamedValue <string, Tag> >()); } } } Pile <Tag> ret = new Pile <Tag>(); if (condsSet.Len < level) { return(ret); } Conditions conds = condsSet[(int)level]; //conds.reset(); if (maxDepth == 0) { return(ret); } foreach (Tag t in _tags) { if (conds.matches(t)) { ret.Add(t); string tagBase = ""; if (resSet.Len > 0) { if (conds.baseName.Length > 0) { if (level == 1) { tagBase = "base:" + ++foundInThisLevel; } else { tagBase = condsSet[(int)level - 1].name + ":" + resSet[condsSet[(int)level - 1].name].Len; } } resSet[(int)level + 1].Add(new NamedValue <string, Tag>(tagBase, t)); } if (level < condsSet.Len) { Tag baseTag = t; NamedValue <string, Tag> namedBaseTag = new NamedValue <string, Tag>(tagBase, baseTag); if (!condsSet[(int)level + 1].baseName.Equals(condsSet[(int)level].name)) { Reach baseName; int num; while (!condsSet[(int)level + 1].baseName.Equals(((Reach)namedBaseTag.Name).before(1, ":"))) { baseName = (Reach)namedBaseTag.Name; num = Int32.Parse(baseName.after(1, ":")); namedBaseTag = resSet[baseName.before(1, ":")][num]; } baseName = (Reach)namedBaseTag.Name; num = Int32.Parse(baseName.after(1, ":")); namedBaseTag = resSet[baseName.before(1, ":")][num]; } baseTag = namedBaseTag.Value; Pile <Tag> subLevelResults = null; condsSet[(int)level + 1].reset(); subLevelResults = baseTag.tags(-1, level + 1, condsSet, resSet); } } else { Pile <Tag> subResults = null; subResults = t.tags(maxDepth - 1, level, condsSet, resSet); if (subResults.Len > 0) { ret.Add(subResults); } } } return(ret); }
public void init(string App_Name, string[] args) //reads Options from Environment, Arguments and Ini-Files INTO the static class "ao" (AppOptions) { /* * dbDrivers.Set("h2s", "h2s 00 (H2Sql)"); * dbDrivers.Set("mys", "mys 01 (Oracle MySql)"); * dbDrivers.Set("2mys", "2mys 01h (MySql Emulation of H2Db)"); * dbDrivers.Set("pgs", "pgs 02 (PostGreSql)"); * dbDrivers.Set("2pgs", "2pgs 02h (PostGreSql Emulation of H2Db)"); * dbDrivers.Set("fbd", "fbd 03 (FireBirdSql)"); * dbDrivers.Set("2fbd", "2fbd 03h (FireBirdSql Emulation of H2Db)"); * dbDrivers.Set("sql", "sql 04 (SqLite)"); * dbDrivers.Set("2sql", "2sql 04h (SqLite Emulation of H2Db)"); * dbDrivers.Set("mss", "mss 05 (MsSqlServer)"); * dbDrivers.Set("2mss", "2mss 05h (MsSqlServer Emulation of H2Db)"); * dbDrivers.Set("syb", "syb 06 (SAP SyBase)"); * dbDrivers.Set("2syb", "2syb 06h (SAP SyBase Emulation of H2Db)"); * dbDrivers.Set("ora", "ora 07 (Oracle)"); * dbDrivers.Set("2ora", "2ora 07h (Oracle Emulation of H2Db)"); * dbDrivers.Set("db2", "db2 08 (IBM DB2)"); * dbDrivers.Set("2db2", "2db2 08h (IBM DB2 Emulation of H2Db)"); * dbDrivers.Set("dby", "dby 09 (Apache Derby)"); * dbDrivers.Set("2dby", "2dby 09h (Apache Derby Emulation of H2Db)"); * dbDrivers.Set("hsq", "hsq 10 (HSqlDb)"); * dbDrivers.Set("2hsq", "2hsq 10h (HSqlDb Emulation of H2Db)"); */ useHtmlAgilityPack = true; // ndStruct should replace the HtmlAgilityPack but ndStruct is not tested enough and ndStructs is not yet performant enough name = App_Name; ctx.args.Add(args); //if (args.Count() != 1) { Console.WriteLine("Usage: " + appName + " \"Directory\""); Console.WriteLine("press any key to abort ..."); Console.ReadKey(); return; } Registry.CurrentUser.CreateSubKey("SOFTWARE\\" + name); string iniContent = ""; try { string iniFile = Path.GetDirectoryName((new Uri(Assembly.GetEntryAssembly().CodeBase)).AbsolutePath) + "/" + name + ".ini".Replace("\\", "/").Replace("//", "\\\\"); iniContent = utl.f2s(iniFile); } catch (Exception e) { try { string iniFile = Path.GetDirectoryName((new Uri(Assembly.GetEntryAssembly().CodeBase)).AbsolutePath) + "\\..\\..\\..\\" + name + ".ini".Replace("\\", "/").Replace("//", "\\\\"); iniContent = utl.f2s(iniFile); } catch (Exception ex) { } // cannot throw Exception because there is no INI-File when ctx has been initialized from a Web App! } while (iniContent.Length > 0) { string line = utl.cutl(ref iniContent, "\n").Replace("\r", "").Trim(); if ((line.IndexOf("=") > -1) & (!line.StartsWith("//"))) { string entryName = utl.cutl(ref line, "=").Trim(); string entryValue = utl.cutl(ref line, "//").Trim(); if (entryName.ToUpper().Equals("FONT")) { Font = entryValue; } else if (entryName.ToUpper().Equals("DBFONT")) { DbFont = entryValue; } else if (entryName.ToUpper().Equals("TSFONT")) { TsFont = entryValue; } else if (entryName.ToUpper().Equals("DBD-H2S")) { dbDrivers.Set("h2s", dbdriverEntry(entryValue)); //00 (H2Sql)"); } else if (entryName.ToUpper().Equals("DBD-MYS")) { dbDrivers.Set("mys", dbdriverEntry(entryValue)); //01 (Oracle MySql)"); } else if (entryName.ToUpper().Equals("DBD-2MYS")) { dbDrivers.Set("2mys", dbdriverEntry(entryValue)); //01h (MySql Emulation of H2Db)"); } else if (entryName.ToUpper().Equals("DBD-PGS")) { dbDrivers.Set("pgs", dbdriverEntry(entryValue)); //02 (PostGreSql)"); } else if (entryName.ToUpper().Equals("DBD-2PGS")) { dbDrivers.Set("2pgs", dbdriverEntry(entryValue)); //02h (PostGreSql Emulation of H2Db)"); } else if (entryName.ToUpper().Equals("DBD-FBD")) { dbDrivers.Set("fbd", dbdriverEntry(entryValue)); //03 (FireBirdSql)"); } else if (entryName.ToUpper().Equals("DBD-2FBD")) { dbDrivers.Set("2fbd", dbdriverEntry(entryValue)); //03h (FireBirdSql Emulation of H2Db)"); } else if (entryName.ToUpper().Equals("DBD-SQL")) { dbDrivers.Set("sql", dbdriverEntry(entryValue)); //04 (SqLite)"); } else if (entryName.ToUpper().Equals("DBD-2SQL")) { dbDrivers.Set("2sql", dbdriverEntry(entryValue)); //04h (SqLite Emulation of H2Db)"); } else if (entryName.ToUpper().Equals("DBD-MSS")) { dbDrivers.Set("mss", dbdriverEntry(entryValue)); //05 (MsSqlServer)"); } else if (entryName.ToUpper().Equals("DBD-2MSS")) { dbDrivers.Set("2mss", dbdriverEntry(entryValue)); //05h (MsSqlServer Emulation of H2Db)"); } else if (entryName.ToUpper().Equals("DBD-SYB")) { dbDrivers.Set("syb", dbdriverEntry(entryValue)); //06 (SAP SyBase)"); } else if (entryName.ToUpper().Equals("DBD-2SYB")) { dbDrivers.Set("2syb", dbdriverEntry(entryValue)); //06h (SAP SyBase Emulation of H2Db)"); } else if (entryName.ToUpper().Equals("DBD-ORA")) { dbDrivers.Set("ora", dbdriverEntry(entryValue)); //07 (Oracle)"); } else if (entryName.ToUpper().Equals("DBD-2ORA")) { dbDrivers.Set("2ora", dbdriverEntry(entryValue)); //07h (Oracle Emulation of H2Db)"); } else if (entryName.ToUpper().Equals("DBD-DB2")) { dbDrivers.Set("db2", dbdriverEntry(entryValue)); //08 (IBM DB2)"); } else if (entryName.ToUpper().Equals("DBD-2DB2")) { dbDrivers.Set("2db2", dbdriverEntry(entryValue)); //08h (IBM DB2 Emulation of H2Db)"); } else if (entryName.ToUpper().Equals("DBD-DBY")) { dbDrivers.Set("dby", dbdriverEntry(entryValue)); //09 (Apache Derby)"); } else if (entryName.ToUpper().Equals("DBD-2DBY")) { dbDrivers.Set("2dby", dbdriverEntry(entryValue)); //09h (Apache Derby Emulation of H2Db)"); } else if (entryName.ToUpper().Equals("DBD-HSQ")) { dbDrivers.Set("hsq", dbdriverEntry(entryValue)); //10 (HSqlDb)"); } else if (entryName.ToUpper().Equals("DBD-2HSQ")) { dbDrivers.Set("2hsq", dbdriverEntry(entryValue)); //10h (HSqlDb Emulation of H2Db)"); } else if (entryName.ToUpper().Equals("DBD-TDA")) { dbDrivers.Set("tda", dbdriverEntry(entryValue)); //11 (Novell TeraData)"); } iniParam.Add(entryName.ToUpper(), entryValue); } } }