示例#1
0
 /// <summary>
 /// Shows a debug message if the debug mode is enabled for the program
 /// </summary>
 /// <param name="message">Message.</param>
 public static void ProcessDebugMessage(string message)
 {
     if (Program.enableDebug)
     {
         StandardPrints.ProcessLog(StandardPrints.ProcessPrint.Debug, message);
     }
 }
示例#2
0
        /// <summary>
        /// Prints all the entities
        /// </summary>
        /// <param name="ShowKey">If set to <c>true</c> show key.</param>
        public void PrintEntities(bool ShowKey)
        {
            if (entities != null)
            {
                byte[] key          = GenKey(seed1, selector);
                byte[] iv           = GenIV(seed2, selector);
                bool   dbValidation = ValidateDecryption(entities, key, iv);

                bool validation = ValidateDecryption(entities, key, iv);

                if (!validation)
                {
                    Console.WriteLine("");
                    StandardPrints.ProcessLog(StandardPrints.ProcessPrint.Info, "There are no entities on the database");
                    Console.WriteLine("");
                    return;
                }

                byte[] decripted = DecryptData(entities, key, iv);

                List <EntityClass> _entities = Helpers.FromByteArray <List <EntityClass> >(decripted);

                decripted = null;
                iv        = null;
                key       = null;

                Console.WriteLine("");
                List <(string, string)> cmds = new List <(string, string)>();
                foreach (EntityClass entity in _entities)
                {
                    (string, string)prt = ShowKey ? (entity.EntityName, entity.Key.FromByteArrayToHex()) : (entity.EntityName, "** HIDDEN **");
                    cmds.Add(prt);
                }
                decripted = null;
                Console.WriteLine(cmds.ToStringTable(
                                      new[] { "Entity", "Key" },
                                      a => a.Item1, a => a.Item2));
                cmds = null;
            }
            else
            {
                Console.WriteLine("");
                StandardPrints.ProcessLog(StandardPrints.ProcessPrint.Info, "There are no entities on the database");
                Console.WriteLine("");
            }
        }