Beispiel #1
0
 public static void ComplexMarkDownOutputFilteringForDictionary()
 {
     TableDic <string, TestClass> .Add(GetSimpleDictionary())
     .ColumnContentTextJustification(new Dictionary <string, TextJustification>
     {
         { "Field3", TextJustification.Right }
     }).ToMarkDown(@"C:\temp\testDic.md", true);
 }
Beispiel #2
0
        public static void SimpleConsoleForDictionary()
        {
            TableDic <string, TestClass> .Add(GetSimpleDictionary())
            .ToConsole();

            TableDic <string, TestClass> .Add(GetSimpleDictionary(), new Options
            {
                DynamicName = "D",
                KeyName     = "Id"
            })
            .ToConsole();

            TableDic <string, TestClass> .Add(GetSimpleDictionary())
            .FilterColumns(new[] { "Key_Id" })
            .ToConsole();

            TableDic <decimal, TestClass> .Add(GetSimpleDictionaryDecimal())
            .ToConsole();
        }
Beispiel #3
0
        public TableItem GetTableInfo(string tableName)
        {
            string tmpName = tableName.ToLower();

            if (TableDic.ContainsKey(tmpName))
            {
                return(TableDic[tmpName]);
            }
            else if (tmpName.EndsWith(".snapshot"))
            {
                tmpName = tmpName.Substring(0, tmpName.Length - 9);
                if (TableDic.ContainsKey(tmpName))
                {
                    return(new TableItem(tmpName, TableDic[tmpName].TableName + ".snapshot",
                                         TableDic[tmpName].ServerName));
                }
            }

            return(null);
        }
Beispiel #4
0
        public void LoadCfg()
        {
            XmlDocument xmlCfg = new XmlDocument();

            xmlCfg.Load(Directory.GetCurrentDirectory() + "/proxy.xml");

            var serverList = xmlCfg.SelectSingleNode("Proxy/ServerSet").ChildNodes;

            foreach (XmlNode node in serverList)
            {
                string serverName = node.Attributes["name"].Value.ToLower();
                string ip         = node.Attributes["ip"].Value;
                int    port       = Convert.ToInt32(node.Attributes["port"].Value);
                string user       = node.Attributes["username"].Value;
                string pwd        = node.Attributes["password"].Value;
                int    maxConn    = Convert.ToInt32(node.Attributes["maxconn"].Value);
                if (!ServerDic.ContainsKey(serverName))
                {
                    ServerDic.Add(serverName, new ServerItem(serverName, ip, port, user, pwd, maxConn));
                }
            }

            var tableList = xmlCfg.SelectSingleNode("Proxy/TableSet").ChildNodes;

            foreach (XmlNode node in tableList)
            {
                string aliasName = node.Attributes["aliasName"].Value.ToLower();
                string tableName = node.Attributes["tableName"].Value;
                string server    = node.Attributes["server"].Value.ToLower();

                if (ServerDic.ContainsKey(server) && !TableDic.ContainsKey(aliasName))
                {
                    TableDic.Add(aliasName, new TableItem(aliasName, tableName, server));
                }
            }
        }
Beispiel #5
0
 public static void SimpleConsoleOutputWithHighlighterForDictionary()
 {
     TableDic <string, TestClass> .Add(GetSimpleDictionary(), new Options
     {
         NumberDecimals = 0
     })
     .HighlightValue(new HighlightOperator
     {
         Field = "Field3", Type = HighlightType.Decimal, DecimalValue = new List <decimal> {
             2121.32m
         },
         Operation = HighlightOperation.Equality
     })
     .HighlightValue(new HighlightOperator
     {
         Field        = "Field6", Type = HighlightType.Decimal,
         DecimalValue = new List <decimal>()
         {
             34.43m, 134.43m
         },
         Operation = HighlightOperation.Equality
     })
     .ToConsole();
 }
Beispiel #6
0
 public static void SimpleHtmlOutputForDictionary()
 {
     TableDic <string, TestClass> .Add(GetSimpleDictionary()).ToHtml(@"C:\temp\test-list-dic.html");
 }
Beispiel #7
0
 public static void SimpleCsvOutputForDictionary()
 {
     TableDic <string, TestClass> .Add(GetSimpleDictionary())
     .ToCsv(@"C:\temp\testDic.csv");
 }