summaryrefslogtreecommitdiff
path: root/support/nlatexdb/nlatexdb
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /support/nlatexdb/nlatexdb
Initial commit
Diffstat (limited to 'support/nlatexdb/nlatexdb')
-rw-r--r--support/nlatexdb/nlatexdb/AssemblyInfo.cs26
-rw-r--r--support/nlatexdb/nlatexdb/CommandParser.cs146
-rw-r--r--support/nlatexdb/nlatexdb/LatexCharReplace.cs61
-rw-r--r--support/nlatexdb/nlatexdb/NlatexdbSettings.cs47
-rw-r--r--support/nlatexdb/nlatexdb/ParseErrorException.cs53
-rw-r--r--support/nlatexdb/nlatexdb/Processer.cs516
-rw-r--r--support/nlatexdb/nlatexdb/Program.cs127
-rw-r--r--support/nlatexdb/nlatexdb/SqlQuery.cs173
-rw-r--r--support/nlatexdb/nlatexdb/SqlQueryVar.cs124
-rw-r--r--support/nlatexdb/nlatexdb/XGetopt.cs234
-rw-r--r--support/nlatexdb/nlatexdb/app.config16
-rw-r--r--support/nlatexdb/nlatexdb/nlatexdb.csproj53
-rw-r--r--support/nlatexdb/nlatexdb/nlatexdb.pidbbin0 -> 22963 bytes
13 files changed, 1576 insertions, 0 deletions
diff --git a/support/nlatexdb/nlatexdb/AssemblyInfo.cs b/support/nlatexdb/nlatexdb/AssemblyInfo.cs
new file mode 100644
index 0000000000..266cabde7b
--- /dev/null
+++ b/support/nlatexdb/nlatexdb/AssemblyInfo.cs
@@ -0,0 +1,26 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+// Information about this assembly is defined by the following attributes.
+// Change them to the values specific to your project.
+
+[assembly: AssemblyTitle("nlatexdb")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("")]
+[assembly: AssemblyCopyright("")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
+// The form "{Major}.{Minor}.*" will automatically update the build and revision,
+// and "{Major}.{Minor}.{Build}.*" will update just the revision.
+
+[assembly: AssemblyVersion("1.0.*")]
+
+// The following attributes are used to specify the signing key for the assembly,
+// if desired. See the Mono documentation for more information about signing.
+
+//[assembly: AssemblyDelaySign(false)]
+//[assembly: AssemblyKeyFile("")]
diff --git a/support/nlatexdb/nlatexdb/CommandParser.cs b/support/nlatexdb/nlatexdb/CommandParser.cs
new file mode 100644
index 0000000000..45b60a2ce5
--- /dev/null
+++ b/support/nlatexdb/nlatexdb/CommandParser.cs
@@ -0,0 +1,146 @@
+// nlatexdb Version 0.03
+// Database Access in LaTeX
+// Copyright (C) 2011 Robin Höns, Integranova GmbH
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+// For more information see the web page http://hoens.net/robin
+
+
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace nlatexdb
+{
+ class CommandParser
+ {
+ public delegate void ExecCommand(List<List<string>> pars);
+
+
+ public CommandParser(string commandname, int nbbraces, bool lastbraceislatex, ExecCommand cmd)
+ {
+ m_commandsearch = String.Concat("\\", commandname, "{");
+ m_nbbraces = nbbraces;
+ m_lastbraceislatex = lastbraceislatex;
+ m_cmd = cmd;
+ }
+
+ public int FirstIndexIn(string line, int commentbegin)
+ {
+ if (commentbegin >= 0)
+ {
+ return line.IndexOf(m_commandsearch, 0, commentbegin);
+ }
+ return line.IndexOf(m_commandsearch);
+ }
+
+ public int StartProcess(string line, int foundindex)
+ {
+ int myindex = foundindex + m_commandsearch.Length;
+ m_bracedepth = 1;
+ m_bracescompleted = 0;
+ m_pars = new List<List<string>>();
+ m_pars.Add(new List<string>());
+ return FindBraces(line, myindex);
+ }
+
+ public int ProcessLine(string line)
+ {
+ return FindBraces(line, 0);
+ }
+
+ private int FindBraces(string line, int startindex)
+ {
+ int i = startindex;
+ StringBuilder sb = new StringBuilder();
+ bool backslash = false;
+ while (i < line.Length)
+ {
+ if (backslash)
+ {
+ backslash = false;
+ }
+ else if (line[i] == '\\')
+ {
+ backslash = true;
+ }
+ else if (line[i] == '%')
+ {
+ // Ein Kommentarzeichen. Der Rest der Zeile wird ignoriert, wenn wir in Latex sind
+ if (m_lastbraceislatex && (m_bracescompleted == m_nbbraces - 1))
+ {
+ sb.Append(line.Substring(i));
+ i = line.Length;
+ break;
+ }
+ }
+ else if (line[i] == '{')
+ {
+ m_bracedepth++;
+ }
+ else if (line[i] == '}')
+ {
+ m_bracedepth--;
+ if (m_bracedepth == 0)
+ {
+ m_pars[m_bracescompleted].Add(sb.ToString());
+ m_bracescompleted++;
+ if (m_bracescompleted == m_nbbraces)
+ {
+ // Alles fertig geparst. Rufe Kommando auf
+
+ m_cmd(m_pars);
+
+ // return Index nach Befehl
+ i++;
+ return i;
+ }
+ else
+ {
+ // nächstes Klammerpaar. Hier MUSS jetzt wieder eine Klammer aufgehen!
+ i++;
+ if (line[i] != '{')
+ {
+ throw new ParseErrorException("Expecting '{' directly after '}'", line, i);
+ }
+ m_pars.Add(new List<string>());
+ m_bracedepth = 1;
+ sb = new StringBuilder();
+ // Die { nicht zu sb hinzufügen, deshalb continue
+ i++;
+ continue;
+ }
+ }
+
+ }
+ sb.Append(line[i]);
+ i++;
+ }
+ m_pars[m_bracescompleted].Add(sb.ToString());
+ return -1; // Command still active
+ }
+
+ private string m_commandsearch;
+ private int m_nbbraces;
+ private int m_bracedepth;
+ private int m_bracescompleted;
+ private bool m_lastbraceislatex;
+
+ private List<List<string>> m_pars;
+ private ExecCommand m_cmd;
+ }
+}
diff --git a/support/nlatexdb/nlatexdb/LatexCharReplace.cs b/support/nlatexdb/nlatexdb/LatexCharReplace.cs
new file mode 100644
index 0000000000..3554f559b7
--- /dev/null
+++ b/support/nlatexdb/nlatexdb/LatexCharReplace.cs
@@ -0,0 +1,61 @@
+
+using System;
+using System.Configuration;
+
+namespace nlatexdb
+{
+
+ [ConfigurationCollection( typeof( LatexCharReplaceElement ) )]
+ public class LatexCharReplaceCollection : ConfigurationElementCollection
+ {
+ protected override ConfigurationElement CreateNewElement()
+ {
+ return new LatexCharReplaceElement();
+ }
+
+ protected override object GetElementKey( ConfigurationElement element )
+ {
+ return ( (LatexCharReplaceElement)( element ) ).Char;
+ }
+
+ public LatexCharReplaceElement this[int idx ]
+ {
+ get
+ {
+ return (LatexCharReplaceElement) BaseGet(idx);
+ }
+ }
+ }
+
+ public class LatexCharReplaceElement : ConfigurationElement
+ {
+ [ConfigurationProperty("char", DefaultValue="", IsKey=true, IsRequired=true)]
+ public string Char
+ {
+ get
+ {
+ return ((string) (base["char"]));
+ }
+ set
+ {
+ base["char"] = value;
+ }
+ }
+
+ [ConfigurationProperty( "replace", DefaultValue = "", IsKey = false, IsRequired = true )]
+ public string Replace
+ {
+ get
+ {
+ return ( (string)( base[ "replace" ] ) );
+ }
+ set
+ {
+ base[ "replace" ] = value;
+ }
+ }
+
+ }
+
+
+}
diff --git a/support/nlatexdb/nlatexdb/NlatexdbSettings.cs b/support/nlatexdb/nlatexdb/NlatexdbSettings.cs
new file mode 100644
index 0000000000..f243f5bf11
--- /dev/null
+++ b/support/nlatexdb/nlatexdb/NlatexdbSettings.cs
@@ -0,0 +1,47 @@
+
+using System;
+using System.Configuration;
+
+namespace nlatexdb
+{
+
+
+ public class NlatexdbSettings: ConfigurationSection
+ {
+ [ConfigurationProperty( "LatexCharReplace" )]
+ public LatexCharReplaceCollection LatexCharReplaceItems
+ {
+ get { return ( (LatexCharReplaceCollection)( base[ "LatexCharReplace" ] ) ); }
+ }
+
+
+[ConfigurationProperty("CmdLineArgumentVarPrefix", IsRequired=false)]
+ public string CmdLineArgumentVarPrefix
+ {
+ get
+ {
+ return (string) this["CmdLineArgumentVarPrefix"];
+ }
+ }
+
+[ConfigurationProperty("RegexSplitter", IsRequired=false)]
+ public string RegexSplitter
+ {
+ get
+ {
+ return (string) this["RegexSplitter"];
+ }
+ }
+
+[ConfigurationProperty("VariableSplitter", IsRequired=false)]
+ public string VariableSplitter
+ {
+ get
+ {
+ return (string) this["VariableSplitter"];
+ }
+ }
+
+
+ }
+}
diff --git a/support/nlatexdb/nlatexdb/ParseErrorException.cs b/support/nlatexdb/nlatexdb/ParseErrorException.cs
new file mode 100644
index 0000000000..fee54cf9b9
--- /dev/null
+++ b/support/nlatexdb/nlatexdb/ParseErrorException.cs
@@ -0,0 +1,53 @@
+// nlatexdb Version 0.03
+// Database Access in LaTeX
+// Copyright (C) 2011 Robin Höns, Integranova GmbH
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+// For more information see the web page http://hoens.net/robin
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace nlatexdb
+{
+ class ParseErrorException : Exception
+ {
+ public ParseErrorException(string error, string line, int index)
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.AppendLine(error);
+ sb.AppendLine(line);
+ for (int i = 0; i < index; i++)
+ {
+ sb.Append(" ");
+ }
+ sb.AppendLine("^");
+ m_message = sb.ToString();
+ }
+
+
+ public override string Message
+ {
+ get
+ {
+ return m_message;
+ }
+ }
+
+ private string m_message;
+ }
+}
diff --git a/support/nlatexdb/nlatexdb/Processer.cs b/support/nlatexdb/nlatexdb/Processer.cs
new file mode 100644
index 0000000000..0935cb2c1e
--- /dev/null
+++ b/support/nlatexdb/nlatexdb/Processer.cs
@@ -0,0 +1,516 @@
+// nlatexdb Version 0.03
+// Database Access in LaTeX
+// Copyright (C) 2011 Robin Höns, Integranova GmbH
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+// For more information see the web page http://hoens.net/robin
+
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.IO;
+
+
+
+namespace nlatexdb
+{
+ class Processer
+ {
+ public Processer()
+ {
+ m_verbosity = 0;
+ m_encoding = Encoding.GetEncoding(1252);
+ m_commandlineargs = new List<string>();
+
+ m_activecommand = null;
+ m_cmds = new List<CommandParser>();
+ m_cmds.Add(new CommandParser("texdbconnectionnet", 2, false, texdbconnection));
+ m_cmds.Add(new CommandParser("texdbdef", 3, false, texdbdef));
+ m_cmds.Add(new CommandParser("texdbfor", 2, true, texdbfor));
+ m_cmds.Add(new CommandParser("texdbforfile", 3, true, texdbforfile));
+ m_cmds.Add(new CommandParser("texdbif", 2, true, texdbif));
+ m_cmds.Add(new CommandParser("texdbcommand", 1, false, texdbcommand));
+
+ m_qrys = new Dictionary<string, SqlQuery>();
+ m_varvalues = new Dictionary<string, SqlQueryVar>();
+ m_latexpostprocess_wholefile = true;
+
+ m_cmdlineargvarprefix = "##";
+
+ SqlQueryVar.ClearLatexReplace();
+ SqlQueryVar.AddLatexReplace('\\', @"\ensuremath{\backslash}");
+ SqlQueryVar.AddLatexReplace('_', @"\_");
+ SqlQueryVar.AddLatexReplace('$', @"\$");
+ SqlQueryVar.AddLatexReplace('&', @"\&");
+ SqlQueryVar.AddLatexReplace('#', @"\#");
+ SqlQueryVar.AddLatexReplace('{', @"\{");
+ SqlQueryVar.AddLatexReplace('}', @"\}");
+ SqlQueryVar.AddLatexReplace('~', @"\~{}");
+ SqlQueryVar.AddLatexReplace('%', @"\%");
+
+
+ ReadAppConfig();
+ }
+
+ private void ReadAppConfig()
+ {
+ NlatexdbSettings settings = System.Configuration.ConfigurationManager.GetSection("NlatexdbSettings")
+ as NlatexdbSettings;
+ if (settings != null)
+ {
+ string cmdl2 = settings.CmdLineArgumentVarPrefix;
+ if (!String.IsNullOrEmpty(cmdl2))
+ {
+ m_cmdlineargvarprefix = cmdl2;
+ Debug("prefix: {0}", cmdl2);
+ }
+
+ string regexsplitter = settings.RegexSplitter;
+ if (!String.IsNullOrEmpty(regexsplitter))
+ {
+ SqlQueryVar.SetRegexSplitter(regexsplitter);
+ }
+
+ string varsplitter = settings.VariableSplitter;
+ if (!String.IsNullOrEmpty(varsplitter))
+ {
+ SqlQuery.SetVariableSplitter(varsplitter);
+ }
+
+ LatexCharReplaceCollection lrcoll = settings.LatexCharReplaceItems;
+ foreach (LatexCharReplaceElement lrelem in lrcoll)
+ {
+ Debug("replace: {0} by: {1}", lrelem.Char[0], lrelem.Replace);
+ SqlQueryVar.AddLatexReplace(lrelem.Char[0], lrelem.Replace);
+ }
+ }
+ }
+
+ public void setInpath(string path)
+ {
+ m_inpath = path;
+ }
+ public void setOutpath(string path)
+ {
+ m_outpath = path;
+ }
+ public void setLatexbefehl(string befehl)
+ {
+ m_latexbefehl = befehl;
+ }
+ public void setEncoding(string enc)
+ {
+ if (enc.Equals("utf-8", StringComparison.InvariantCultureIgnoreCase))
+ {
+ m_encoding = new UTF8EncodingWithoutPreamble();
+ }
+ else
+ {
+ try
+ {
+ m_encoding = Encoding.GetEncoding(enc);
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine(ex.Message);
+ Debug(ex.ToString());
+ }
+ }
+ }
+
+ public void incVerbosity()
+ {
+ m_verbosity++;
+ }
+
+ public void addCmdlineArg(string arg)
+ {
+ m_commandlineargs.Add(arg);
+ string key = m_cmdlineargvarprefix + m_commandlineargs.Count.ToString();
+ m_varvalues[key] = new SqlQueryVar(key, arg);
+;
+ }
+
+ public int Go()
+ {
+ int ergebnis = 0;
+ try
+ {
+ if (String.IsNullOrEmpty(m_inpath))
+ {
+ throw new Exception("No input file given!");
+ }
+
+ string outpath = m_outpath;
+ if (String.IsNullOrEmpty(outpath))
+ {
+ outpath = m_inpath.Replace(".tex", "1.tex");
+ if (String.IsNullOrEmpty(outpath))
+ {
+ outpath = String.Concat(m_inpath, "1");
+ }
+ }
+
+ using (StreamReader sr = new StreamReader(m_inpath, m_encoding))
+ {
+ try
+ {
+ OpenOutstream(outpath);
+
+ string line;
+ while ((line = sr.ReadLine()) != null)
+ {
+ HandleLine(line);
+ }
+ }
+ finally
+ {
+ CloseOutstream();
+ }
+ }
+
+ LatexPostprocess(outpath, true);
+
+
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine(ex.Message);
+ Debug(ex.ToString());
+ ergebnis = 1;
+ }
+ finally
+ {
+ if (m_conn != null)
+ {
+ try
+ {
+ m_conn.Close();
+ }
+ catch
+ {
+ }
+ }
+
+ if (m_outstream != null)
+ {
+ try
+ {
+ m_outstream.Close();
+ }
+ catch
+ {
+ }
+ }
+ }
+ return ergebnis;
+ }
+
+ public void OpenOutstream(string outpath)
+ {
+ CloseOutstream(); // just in case
+ System.IO.FileStream outstream =
+ new System.IO.FileStream(outpath, System.IO.FileMode.Create, System.IO.FileAccess.Write);
+ m_outstream = new System.IO.StreamWriter(outstream, m_encoding);
+ }
+
+ public void CloseOutstream()
+ {
+ if (m_outstream != null)
+ {
+ m_outstream.Close();
+ m_outstream=null;
+ }
+ }
+
+ public void LatexPostprocess(string texinputpath, bool renametoinpath)
+ {
+ if (renametoinpath && !m_latexpostprocess_wholefile)
+ {
+ // If there was a \texdbforfile command, don't postprocess the
+ // top file: It is expected to be empty.
+ return;
+ }
+
+ if (!String.IsNullOrEmpty(m_latexbefehl))
+ {
+ System.Diagnostics.Process p = new System.Diagnostics.Process();
+ p.StartInfo.FileName = m_latexbefehl;
+ p.StartInfo.CreateNoWindow = true;
+ p.StartInfo.Arguments = texinputpath;
+ p.Start();
+ p.WaitForExit();
+
+
+ string extension = null;
+ if (m_latexbefehl.Equals("latex"))
+ {
+ extension = "dvi";
+ }
+ else if (m_latexbefehl.Equals("pdflatex"))
+ {
+ extension = "pdf";
+ }
+
+ if (renametoinpath && !String.IsNullOrEmpty(extension))
+ {
+ string filefromlatex = System.IO.Path.ChangeExtension(texinputpath, extension);
+ string filetorename = System.IO.Path.ChangeExtension(m_inpath, extension);
+ System.IO.File.Delete(filetorename);
+ System.IO.File.Move(filefromlatex, filetorename);
+ }
+
+
+ }
+
+ }
+
+ public void ListProviders()
+ {
+ System.Data.DataTable providers = System.Data.Common.DbProviderFactories.GetFactoryClasses();
+ foreach (System.Data.DataRow provider in providers.Rows)
+ {
+ foreach (System.Data.DataColumn c in providers.Columns)
+ Console.WriteLine(c.ColumnName + ":" + provider[c]);
+ Console.WriteLine("---");
+ }
+ }
+
+
+// private void HandleLineUnlessEmpty(string line)
+// {
+// if (!String.IsNullOrEmpty(line))
+// {
+// HandleLine(line);
+// }
+// }
+
+ private void HandleRestOfLine(string line, int hintercmd)
+ {
+ if (hintercmd >= 0 && hintercmd < line.Length)
+ {
+ HandleLine(line.Substring(hintercmd));
+ }
+ }
+
+ public void HandleLine(string line)
+ {
+ if (m_activecommand != null)
+ {
+ // Aha, ein Kommando ist aktiv. Sammele die Zeilen.
+ int hintercmd = m_activecommand.ProcessLine(line);
+ HandleRestOfLine(line, hintercmd);
+ return;
+ }
+
+ // Erstmal schauen nach Kommentar
+ int prozentsuche = 0;
+ int prozentindex = -1;
+ while (prozentsuche >= 0)
+ {
+ prozentindex = line.IndexOf('%', prozentsuche);
+ if (prozentindex > 0 && line[prozentindex - 1] == '\\')
+ {
+ // Dieses % ist auskommentiert. Dahinter weitersuchen.
+ prozentsuche = prozentindex + 1;
+ prozentindex = -1;
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ int firstcommandindex = line.Length + 1;
+ foreach (CommandParser c in m_cmds)
+ {
+ int cmdindex = c.FirstIndexIn(line, prozentindex);
+ if (cmdindex >= 0 && cmdindex < firstcommandindex)
+ {
+ m_activecommand = c;
+ firstcommandindex = cmdindex;
+ }
+ }
+
+ if (m_activecommand != null)
+ {
+ // Aha, Kommando gefunden.
+ if (firstcommandindex > 0)
+ {
+ // Da ist noch Text davor.
+ HandleLine(line.Substring(0, firstcommandindex));
+ }
+
+ // Rufe Kommando auf. Bzw. erstmal die Klammern suchen.
+ int hintercmd = m_activecommand.StartProcess(line, firstcommandindex);
+ HandleRestOfLine(line, hintercmd);
+ }
+ else
+ {
+ // Kein Kommando in dieser Zeile. Einfach ausgeben. Erst aber Variablen einfügen.
+ line = VariablenEinfuegen(line);
+ m_outstream.WriteLine(line);
+ }
+ }
+
+ public string VariablenEinfuegen(string inputline)
+ {
+ string line = inputline;
+ foreach (KeyValuePair<string, SqlQueryVar> var in m_varvalues)
+ {
+ line = line.Replace(var.Key, var.Value.getValueLatex());
+ }
+ return line;
+ }
+
+ private string listtostr(List<string> lines)
+ {
+ StringBuilder sb = new StringBuilder();
+ foreach (string s in lines)
+ {
+ if (sb.Length > 0)
+ {
+ sb.Append(" ");
+ }
+ sb.Append(s);
+ }
+ return sb.ToString();
+ }
+
+ private void texdbconnection(List<List<string>> pars)
+ {
+ m_activecommand = null;
+ string provider = listtostr(pars[0]);
+ string connstring = listtostr(pars[1]);
+ Debug("texdbconnection provider: {0} connstring: {1}", provider, connstring);
+ System.Data.Common.DbProviderFactory dbfac = System.Data.Common.DbProviderFactories.GetFactory(provider);
+ m_conn = dbfac.CreateConnection();
+ m_conn.ConnectionString = connstring;
+ m_conn.Open();
+ }
+
+ private void texdbdef(List<List<string>> pars)
+ {
+ m_activecommand = null;
+ string queryname = listtostr(pars[0]);
+ string querytext = listtostr(pars[1]);
+ string queryvars = listtostr(pars[2]);
+ Debug("texdbdef name: {0} sql: {1} vars: {2}", queryname, querytext, queryvars);
+ m_qrys.Add(queryname, new SqlQuery(querytext, queryvars));
+ }
+
+ private void texdbfor(List<List<string>> pars)
+ {
+ m_activecommand = null;
+ string queryname = listtostr(pars[0]);
+ List<string> texstuff = pars[1];
+ Debug("texdbfor query: {0} tex lines: {1}", queryname, texstuff.Count);
+ SqlQuery qry = m_qrys[queryname];
+ if (qry == null)
+ {
+ throw new Exception("Query " + queryname + " not found");
+ }
+ qry.Execute(texstuff, m_conn, m_varvalues, this, null);
+ }
+
+ private void texdbforfile(List<List<string>> pars)
+ {
+ m_activecommand = null;
+ m_latexpostprocess_wholefile = false;
+ string queryname = listtostr(pars[0]);
+ string filepattern = listtostr(pars[1]);
+ List<string> texstuff = pars[2];
+ Debug("texdbforfile query: {0} filepattern: {1} tex lines: {2}", queryname, filepattern, texstuff.Count);
+ SqlQuery qry = m_qrys[queryname];
+ if (qry == null)
+ {
+ throw new Exception("Query " + queryname + " not found");
+ }
+ qry.Execute(texstuff, m_conn, m_varvalues, this, filepattern);
+ }
+
+ private void texdbif(List<List<string>> pars)
+ {
+ m_activecommand = null;
+ string queryname = listtostr(pars[0]);
+ List<string> texstuff = pars[1];
+ Debug("texdbif query: {0} tex lines: {1}", queryname, texstuff.Count);
+ SqlQuery qry = m_qrys[queryname];
+ if (qry == null)
+ {
+ throw new Exception("Query " + queryname + " not found");
+ }
+ qry.ExecuteIf(texstuff, m_conn, m_varvalues, this);
+ }
+
+ private void texdbcommand(List<List<string>> pars)
+ {
+ m_activecommand = null;
+ string cmd = listtostr(pars[0]);
+ Debug("texdbcommand sql: {0}", cmd);
+ using (System.Data.Common.DbCommand comm = m_conn.CreateCommand())
+ {
+ comm.CommandText = cmd;
+ comm.ExecuteNonQuery();
+ }
+ }
+
+ public static void Debug(string format, params object[] pars)
+ {
+ if (m_verbosity >= 1)
+ {
+ Console.WriteLine(format, pars);
+ }
+ }
+
+ private string m_cmdlineargvarprefix;
+
+ private static int m_verbosity = 0;
+ private string m_outpath;
+ private string m_latexbefehl;
+ private bool m_latexpostprocess_wholefile;
+ private Encoding m_encoding;
+ private string m_inpath;
+ private List<string> m_commandlineargs;
+ private System.Data.Common.DbConnection m_conn;
+
+ private List<CommandParser> m_cmds;
+ private CommandParser m_activecommand;
+ private System.IO.StreamWriter m_outstream;
+
+ private System.Collections.Generic.Dictionary<string, SqlQuery> m_qrys;
+ private System.Collections.Generic.Dictionary<string, SqlQueryVar> m_varvalues;
+
+ }
+}
+
+
+// Latex can't handle the BOM (EF BB BF) that is prepended to UTF-8 by default.
+// So here's a UTF-8 encoding without BOM.
+
+public class UTF8EncodingWithoutPreamble : System.Text.UTF8Encoding
+{
+ public static UTF8EncodingWithoutPreamble Instance = new
+ UTF8EncodingWithoutPreamble();
+
+ private static byte[] _preamble = new byte[0];
+
+ public override byte[] GetPreamble()
+ {
+ return _preamble;
+ }
+}
diff --git a/support/nlatexdb/nlatexdb/Program.cs b/support/nlatexdb/nlatexdb/Program.cs
new file mode 100644
index 0000000000..68b1960e8a
--- /dev/null
+++ b/support/nlatexdb/nlatexdb/Program.cs
@@ -0,0 +1,127 @@
+// nlatexdb Version 0.03
+// Database Access in LaTeX
+// Copyright (C) 2011 Robin Höns, Integranova GmbH
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+// For more information see the web page http://hoens.net/robin
+
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using XGetoptCS;
+
+namespace nlatexdb
+{
+ class Program
+ {
+ static void Help()
+ {
+ Console.WriteLine("NatexDB 0.03 Copyright (C) 2011 Robin Hoens");
+ Console.WriteLine("This program comes with ABSOLUTELY NO WARRANTY.");
+ Console.WriteLine("This is free software, and you are welcome to redistribute it");
+ Console.WriteLine("under certain conditions.");
+ Console.WriteLine("See file COPYING for details.");
+ Console.WriteLine();
+ Console.WriteLine("Usage:");
+ Console.WriteLine("nlatexdb [Arguments] <texfile.tex> [Parameters...]");
+ Console.WriteLine("Arguments can be:");
+ Console.WriteLine("-p = call pdflatex on result");
+ Console.WriteLine("-l = call latex on result");
+ Console.WriteLine("-c <latexcommand> = call <latexcommand> on result");
+ Console.WriteLine("-e <encoding> = use string <encoding> on input and output file");
+ Console.WriteLine("-o <outpath> = write result to <outpath>");
+ Console.WriteLine("-P = list known database providers");
+ Console.WriteLine("-v = increase verbosity");
+ Console.WriteLine("-h = output this help text");
+ }
+
+
+ static int Main(string[] args)
+ {
+ Processer proc = new Processer();
+ int argc = args.Length;
+ bool help = false;
+ char c;
+ XGetopt go = new XGetopt();
+ while ((c = go.Getopt(argc, args, "plvho:c:Pe:")) != '\0')
+ {
+ switch (c)
+ {
+ case 'P':
+ proc.ListProviders();
+ break;
+
+ case 'p':
+ proc.setLatexbefehl("pdflatex");
+ break;
+
+ case 'l':
+ proc.setLatexbefehl("latex");
+ break;
+
+ case 'c':
+ proc.setLatexbefehl(go.Optarg);
+ break;
+
+ case 'e':
+ proc.setEncoding(go.Optarg);
+ break;
+
+ case 'o':
+ proc.setOutpath(go.Optarg);
+ break;
+
+ case 'v':
+ proc.incVerbosity();
+ break;
+
+ case 'h':
+ help = true;
+ break;
+
+ case '?':
+ Console.WriteLine("illegal option or missing arg");
+ help = true;
+ break;
+ }
+ }
+
+ if (go.Optarg != string.Empty)
+ {
+ proc.setInpath(go.Optarg);
+ int i = go.Optind + 1;
+ while (i < args.Length)
+ {
+ proc.addCmdlineArg(args[i]);
+ i++;
+ }
+ }
+ else
+ {
+ help = true;
+ }
+
+ if (help)
+ {
+ Help();
+ return 1;
+ }
+
+ return proc.Go();
+ }
+ }
+}
diff --git a/support/nlatexdb/nlatexdb/SqlQuery.cs b/support/nlatexdb/nlatexdb/SqlQuery.cs
new file mode 100644
index 0000000000..68934a2c78
--- /dev/null
+++ b/support/nlatexdb/nlatexdb/SqlQuery.cs
@@ -0,0 +1,173 @@
+// nlatexdb Version 0.03
+// Database Access in LaTeX
+// Copyright (C) 2011 Robin Höns, Integranova GmbH
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+// For more information see the web page http://hoens.net/robin
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace nlatexdb
+{
+ class SqlQuery
+ {
+ public SqlQuery(string querytext, string queryvars)
+ {
+ m_querytext = querytext;
+ string[] qvars = queryvars.Split(m_variablesplitter);
+ m_queryvars = new List<SqlQueryVar>();
+ foreach (string s in qvars)
+ {
+ Processer.Debug("Var: {0}", s);
+ m_queryvars.Add(new SqlQueryVar(s.Trim()));
+ }
+ }
+
+ public static void SetVariableSplitter(string var_splitter)
+ {
+ m_variablesplitter = var_splitter.ToCharArray();
+ }
+
+
+ private void ReplaceVariables(System.Data.Common.DbCommand comm,
+ System.Collections.Generic.Dictionary<string, SqlQueryVar> varvalues)
+ {
+ string querytext = m_querytext;
+ System.Collections.Generic.SortedDictionary<int, KeyValuePair<string, object>> repls =
+ new SortedDictionary<int, KeyValuePair<string, object>>();
+ foreach (KeyValuePair<string, SqlQueryVar> var in varvalues)
+ {
+ int startindex = 0;
+ while (startindex >= 0 && startindex < querytext.Length)
+ {
+ int varindex = querytext.IndexOf(var.Key, startindex);
+ if (varindex >= 0)
+ {
+ repls[varindex] = new KeyValuePair<string, object>(var.Key, var.Value.getValueSql());
+ startindex = varindex + 1;
+ }
+ else
+ {
+ break;
+ }
+ }
+ }
+ int j = 1;
+ // Alle Variablenvorkommen sind nun sortiert im repl-Verzeichnis.
+ foreach (KeyValuePair<string, object> replacement in repls.Values)
+ {
+ string parname = String.Format("@{0}", j);
+ querytext = querytext.Replace(replacement.Key, parname);
+ System.Data.Common.DbParameter par = comm.CreateParameter();
+ par.Value = replacement.Value;
+ par.ParameterName = parname;
+ comm.Parameters.Add(par);
+ j++;
+ }
+ comm.CommandText = querytext;
+ }
+
+ private List<object[]> ExecuteSql(System.Data.Common.DbConnection connection,
+ System.Collections.Generic.Dictionary<string, SqlQueryVar> varvalues)
+ {
+ List<object[]> alldata = new List<object[]>();
+ using (System.Data.Common.DbCommand comm = connection.CreateCommand())
+ {
+ ReplaceVariables(comm, varvalues);
+
+ using (System.Data.Common.DbDataReader rdr = comm.ExecuteReader())
+ {
+ while (rdr.Read())
+ {
+ object[] myline = new object[rdr.FieldCount];
+ rdr.GetValues(myline);
+ alldata.Add(myline);
+ }
+ rdr.Close();
+ }
+ }
+ return alldata;
+ }
+
+ public void Execute(List<string> texstuff, System.Data.Common.DbConnection connection,
+ System.Collections.Generic.Dictionary<string, SqlQueryVar> varvalues,
+ Processer proc,
+ string filenamepattern)
+ {
+ List<object[]> alldata = ExecuteSql(connection, varvalues);
+ foreach (object[] objline in alldata)
+ {
+
+ for (int i = 0; i < m_queryvars.Count; i++)
+ {
+ m_queryvars[i].setValue(objline[i]);
+ if (!varvalues.ContainsKey(m_queryvars[i].Name))
+ {
+ varvalues.Add(m_queryvars[i].Name, m_queryvars[i]);
+ }
+ }
+
+ string outpath = null;
+ if (!String.IsNullOrEmpty(filenamepattern))
+ {
+ outpath = proc.VariablenEinfuegen(filenamepattern);
+ proc.OpenOutstream(outpath);
+ }
+
+ foreach (string line in texstuff)
+ {
+ proc.HandleLine(line);
+ }
+
+ if (!String.IsNullOrEmpty(outpath))
+ {
+ proc.CloseOutstream();
+ proc.LatexPostprocess(outpath, false);
+ }
+ }
+ }
+
+
+ public void ExecuteIf(List<string> texstuff, System.Data.Common.DbConnection connection,
+ System.Collections.Generic.Dictionary<string, SqlQueryVar> varvalues, Processer proc)
+ {
+ using (System.Data.Common.DbCommand comm = connection.CreateCommand())
+ {
+ ReplaceVariables(comm, varvalues);
+
+ using (System.Data.Common.DbDataReader rdr = comm.ExecuteReader())
+ {
+ if (!rdr.HasRows)
+ {
+ rdr.Close();
+ return;
+ }
+ rdr.Close();
+ }
+ }
+ foreach (string line in texstuff)
+ {
+ proc.HandleLine(line);
+ }
+ }
+
+ private string m_querytext;
+ private List<SqlQueryVar> m_queryvars;
+ private static char[] m_variablesplitter = { ',' };
+ }
+}
diff --git a/support/nlatexdb/nlatexdb/SqlQueryVar.cs b/support/nlatexdb/nlatexdb/SqlQueryVar.cs
new file mode 100644
index 0000000000..6c4c88db3b
--- /dev/null
+++ b/support/nlatexdb/nlatexdb/SqlQueryVar.cs
@@ -0,0 +1,124 @@
+// nlatexdb Version 0.03
+// Database Access in LaTeX
+// Copyright (C) 2011 Robin Höns, Integranova GmbH
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+// For more information see the web page http://hoens.net/robin
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace nlatexdb
+{
+ class SqlQueryVar
+ {
+ public SqlQueryVar(string key, object value)
+ {
+ m_varname = key;
+ m_regexreplace = new List<string>();
+ setValue(value);
+ }
+
+ public SqlQueryVar(string vartext)
+ {
+ string[] varsplit = vartext.Split(m_regexsplitter);
+ m_varname = varsplit[0];
+ m_regexreplace = new List<string>(varsplit);
+ m_regexreplace.RemoveAt(0);
+ }
+
+ public void setValue(object value)
+ {
+ m_value = value;
+ string valuestring = objectToLatex(m_value);
+ for (int i = 1; i < m_regexreplace.Count; i += 2)
+ {
+ string search = m_regexreplace[i - 1];
+ string replace = m_regexreplace[i];
+ Processer.Debug("Search: {0} Replace: {1}", search, replace);
+ System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(search);
+ valuestring = regex.Replace(valuestring, replace);
+ // so im groben
+ }
+ m_valuelatex = valuestring;
+ }
+
+ private static string objectToLatex(object o)
+ {
+ string s = o.ToString();
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < s.Length; i++)
+ {
+ if (m_latexreplace.ContainsKey(s[i]))
+ {
+ sb.Append(m_latexreplace[s[i]]);
+ }
+ else
+ {
+ sb.Append(s[i]);
+ }
+ }
+ return sb.ToString();
+ }
+
+ public string Name
+ {
+ get
+ {
+ return m_varname;
+ }
+ }
+
+ public string getValueLatex()
+ {
+ return m_valuelatex;
+ }
+
+ public object getValueSql()
+ {
+ return m_value;
+ }
+
+ public static void ClearLatexReplace()
+ {
+ if (m_latexreplace == null)
+ {
+ m_latexreplace = new Dictionary<char, string>();
+ }
+ m_latexreplace.Clear();
+ }
+
+ public static void AddLatexReplace(char latexchar, string replace)
+ {
+ m_latexreplace[latexchar] = replace;
+ }
+
+ public static void SetRegexSplitter(string regex_splitter)
+ {
+ m_regexsplitter = regex_splitter.ToCharArray();
+ }
+
+
+ private string m_varname;
+ private object m_value;
+ private string m_valuelatex;
+ private List<string> m_regexreplace;
+ private static char[] m_regexsplitter = { '/' };
+
+ private static Dictionary<char, string> m_latexreplace;
+ }
+}
diff --git a/support/nlatexdb/nlatexdb/XGetopt.cs b/support/nlatexdb/nlatexdb/XGetopt.cs
new file mode 100644
index 0000000000..289a85f727
--- /dev/null
+++ b/support/nlatexdb/nlatexdb/XGetopt.cs
@@ -0,0 +1,234 @@
+// XGetopt.cs Version 1.0
+//
+// Author: Hans Dietrich
+// hdietrich@gmail.com
+//
+// Description:
+// The Getopt() method parses command line arguments. It is modeled
+// after the Unix function getopt(). Its parameters argc and argv are
+// the argument count and array as passed into the application on program
+// invocation. Getopt returns the next option letter in argv that
+// matches a letter in optstring.
+//
+// optstring is a string of allowable option letters; if a letter is
+// followed by a colon, the option is expected to have an argument that
+// may or may not be separated from it by white space. optarg contains
+// the option argument on return from Getopt (use the Optarg property).
+//
+// Option letters may be combined, e.g., "-ab" is equivalent to "-a -b".
+// Option letters are case sensitive.
+//
+// Getopt places in the internal variable optind the argv index of the
+// next argument to be processed. optind is initialized to 0 before the
+// first call to Getopt. Use the Optind property to query the optind
+// value.
+//
+// When all options have been processed (i.e., up to the first non-option
+// argument), Getopt returns '\0', optarg will contain the argument,
+// and optind will be set to the argv index of the argument. If there
+// are no non-option arguments, optarg will be Empty.
+//
+// The special option "--" may be used to delimit the end of the options;
+// '\0' will be returned, and "--" (and everything after it) will be
+// skipped.
+//
+// Return Value:
+// For option letters contained in the string optstring, Getopt will
+// return the option letter. Getopt returns a question mark ('?') when
+// it encounters an option letter not included in optstring. '\0' is
+// returned when processing is finished.
+//
+// Limitations:
+// 1) Long options are not supported.
+// 2) The GNU double-colon extension is not supported.
+// 3) The environment variable POSIXLY_CORRECT is not supported.
+// 4) The + syntax is not supported.
+// 5) The automatic permutation of arguments is not supported.
+// 6) This implementation of Getopt() returns '\0' if an error is
+// encountered, instead of -1 as the latest standard requires.
+// 7) This implementation of Getopt() returns a char instead of an int.
+//
+// Example:
+// static int Main(string[] args)
+// {
+// int argc = args.Length;
+// char c;
+// XGetopt go = new XGetopt();
+// while ((c = go.Getopt(argc, args, "aBn:")) != '\0')
+// {
+// switch (c)
+// {
+// case 'a':
+// Console.WriteLine("option -a");
+// break;
+//
+// case 'B':
+// Console.WriteLine("option -B");
+// break;
+//
+// case 'n':
+// Console.WriteLine("option -n with arg '{0}'", go.Optarg);
+// break;
+//
+// case '?':
+// Console.WriteLine("illegal option or missing arg");
+// return 1;
+// }
+// }
+//
+// if (go.Optarg != string.Empty)
+// Console.WriteLine("non-option arg '{0}'", go.Optarg);
+//
+// ...
+//
+// return 0;
+// }
+//
+// History:
+// Version 1.0 - 2007 June 5
+// - Initial public release
+//
+// License:
+// This software is released into the public domain. You are free to use
+// it in any way you like, except that you may not sell this source code.
+//
+// This software is provided "as is" with no expressed or implied warranty.
+// I accept no liability for any damage or loss of business that this
+// software may cause.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+//#define XGETOPT_VERBOSE
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace XGetoptCS
+{
+ public class XGetopt
+ {
+ #region Class data
+
+ private int optind;
+ private string nextarg;
+ private string optarg;
+
+ #endregion
+
+ #region Class properties
+
+ public string Optarg
+ {
+ get
+ {
+ return optarg;
+ }
+ }
+
+ public int Optind
+ {
+ get
+ {
+ return optind;
+ }
+ }
+
+ #endregion
+
+ #region Class public methods
+
+ public XGetopt()
+ {
+ Init();
+ }
+
+ public void Init()
+ {
+ optind = 0;
+ optarg = string.Empty;
+ nextarg = string.Empty;
+ }
+
+ public char Getopt(int argc, string[] argv, string optstring)
+ {
+#if XGETOPT_VERBOSE
+ Console.WriteLine("Getopt: argc = {0}", argc);
+#endif
+
+ optarg = string.Empty;
+
+ if (argc < 0)
+ return '?';
+
+#if XGETOPT_VERBOSE
+ if (optind < argc)
+ Console.WriteLine("Getopt: argv[{0}] = {1}", optind, argv[optind]);
+#endif
+
+ if (optind == 0)
+ nextarg = string.Empty;
+
+ if (nextarg.Length == 0)
+ {
+ if (optind >= argc || argv[optind][0] != '-' || argv[optind].Length < 2)
+ {
+ // no more options
+ optarg = string.Empty;
+ if (optind < argc)
+ optarg = argv[optind]; // return leftover arg
+ return '\0';
+ }
+
+ if (argv[optind] == "--")
+ {
+ // 'end of options' flag
+ optind++;
+ optarg = string.Empty;
+ if (optind < argc)
+ optarg = argv[optind];
+ return '\0';
+ }
+
+ nextarg = string.Empty;
+ if (optind < argc)
+ {
+ nextarg = argv[optind];
+ nextarg = nextarg.Substring(1); // skip past -
+ }
+ optind++;
+ }
+
+ char c = nextarg[0]; // get option char
+ nextarg = nextarg.Substring(1); // skip past option char
+ int index = optstring.IndexOf(c); // check if this is valid option char
+
+ if (index == -1 || c == ':')
+ return '?';
+
+ index++;
+ if ((index < optstring.Length) && (optstring[index] == ':'))
+ {
+ // option takes an arg
+ if (nextarg.Length > 0)
+ {
+ optarg = nextarg;
+ nextarg = string.Empty;
+ }
+ else if (optind < argc)
+ {
+ optarg = argv[optind];
+ optind++;
+ }
+ else
+ {
+ return '?';
+ }
+ }
+
+ return c;
+ }
+
+ #endregion
+ }
+}
diff --git a/support/nlatexdb/nlatexdb/app.config b/support/nlatexdb/nlatexdb/app.config
new file mode 100644
index 0000000000..3d60310e1a
--- /dev/null
+++ b/support/nlatexdb/nlatexdb/app.config
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+ <configSections>
+ <section name="NlatexdbSettings" type="nlatexdb.NlatexdbSettings,nlatexdb"/>
+ </configSections>
+
+<NlatexdbSettings
+CmdLineArgumentVarPrefix="??"
+RegexSplitter="/"
+VariableSplitter=","
+>
+<LatexCharReplace>
+<add char="€" replace="\euro" />
+</LatexCharReplace>
+</NlatexdbSettings>
+</configuration> \ No newline at end of file
diff --git a/support/nlatexdb/nlatexdb/nlatexdb.csproj b/support/nlatexdb/nlatexdb/nlatexdb.csproj
new file mode 100644
index 0000000000..497b6fe66f
--- /dev/null
+++ b/support/nlatexdb/nlatexdb/nlatexdb.csproj
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{E7A0AF1A-575D-4FDC-A01B-2106E4806657}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <RootNamespace>nlatexdb</RootNamespace>
+ <AssemblyName>nlatexdb</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug</OutputPath>
+ <DefineConstants>DEBUG</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <PlatformTarget>x86</PlatformTarget>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <DebugType>none</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Release</OutputPath>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <PlatformTarget>x86</PlatformTarget>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Configuration" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="AssemblyInfo.cs" />
+ <Compile Include="CommandParser.cs" />
+ <Compile Include="ParseErrorException.cs" />
+ <Compile Include="Processer.cs" />
+ <Compile Include="Program.cs" />
+ <Compile Include="SqlQuery.cs" />
+ <Compile Include="SqlQueryVar.cs" />
+ <Compile Include="XGetopt.cs" />
+ <Compile Include="LatexCharReplace.cs" />
+ <Compile Include="NlatexdbSettings.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <ItemGroup>
+ <None Include="app.config" />
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/support/nlatexdb/nlatexdb/nlatexdb.pidb b/support/nlatexdb/nlatexdb/nlatexdb.pidb
new file mode 100644
index 0000000000..312658a2c0
--- /dev/null
+++ b/support/nlatexdb/nlatexdb/nlatexdb.pidb
Binary files differ