Exemplo n.º 1
0
        string PrintMediaInfo(Dictionary <string, string> mediaInfo)
        {
            String info = "\nMediaInfo\n";
            List <List <string> > rows = new List <List <string> >();

            foreach (KeyValuePair <String, String> temp in mediaInfo)
            {
                rows.Add(new List <String>()
                {
                    temp.Key, temp.Value
                });
            }
            ConsoleTableUtil ctu = new ConsoleTableUtil(null, rows, null);

            ctu.ColsAlign = new ColAlign[] { ColAlign.left, ColAlign.left };
            ctu.Width     = 6 * 12;
            info         += ctu.PrintTable();
            return(info);
        }
Exemplo n.º 2
0
        string PrintInvalids(List <InvalidInfo> invalids)
        {
            String invalidMessage = "";
            Dictionary <MIRuleGroup, List <InvalidInfo> > invalidRules = new Dictionary <MIRuleGroup, List <InvalidInfo> >();

            if (invalids.Count > 0)
            {
                invalidMessage += "Invalid standards\n";
                List <String> headers = new List <String>()
                {
                    "Param", "Standard", "File's info"
                };
                List <List <string> > rows = new List <List <string> >();
                for (var i = 0; i < invalids.Count; i++)
                {
                    InvalidInfo invalid = invalids[i];
                    if (invalid.ruleGroup != null)
                    {
                        if (!invalidRules.ContainsKey(invalid.ruleGroup))
                        {
                            invalidRules.Add(invalid.ruleGroup, new List <InvalidInfo>());
                        }
                        invalidRules[invalid.ruleGroup].Add(invalid);
                    }
                    else
                    {
                        rows.Add(new List <String>()
                        {
                            invalid.name, invalid.StandardS, invalid.info
                        });
                    }
                }
                ConsoleTableUtil ctu = new ConsoleTableUtil(null, new List <List <String> >()
                {
                    headers
                }, rows);
                ctu.Width = 12 * 10 + 4;
                String invalidStandards = ctu.PrintTable();
                invalidMessage += invalidStandards + "\n";
            }
            if (invalidRules.Count > 0)
            {
                invalidMessage += "Invalid rules\n";

                foreach (KeyValuePair <MIRuleGroup, List <InvalidInfo> > invalidRule in invalidRules)
                {
                    MIRuleGroup           group   = invalidRule.Key;
                    List <List <String> > headers = new List <List <String> >()
                    {
                        new List <String>()
                        {
                            "Rule: " + group
                        }, new List <String>()
                        {
                            "Param", "Allow", "File's info"
                        }
                    };
                    List <List <string> > rows = new List <List <string> >();

                    for (var j = 0; j < invalidRule.Value.Count; j++)
                    {
                        InvalidInfo invalid = invalidRule.Value[j];
                        rows.Add(new List <String>()
                        {
                            invalid.name, invalid.StandardS, invalid.info
                        });
                    }
                    ConsoleTableUtil ctu = new ConsoleTableUtil(null, headers, rows);
                    ctu.Cols = new int[] { 12 * 5, 12 * 3, 12 * 2 };
                    String invalidRuleStr = ctu.PrintTable();
                    invalidMessage += invalidRuleStr + "\n";
                }
            }
            return(invalidMessage);
        }