Пример #1
0
 public override void Log(ExceptionLoggerContext context)
 {
     try
     {
         Logger.Fatal($"Unhandled exception occurred on server '{Environment.MachineName}' while processing {context.Request.Method.ToString()} for {context.Request.RequestUri.ToString()}", context.Exception);
     }
     catch (Exception ex)
     {
         Console.WriteLine($"Unhandled exception occurred on server '{Environment.MachineName}'", ex.ToString());
     }
 }
        static void Main(string[] args)
        {
            Logger.Info(": : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :");
            Logger.Info(": : : : : : : : : : Encrypt / Decrypt Test: : : : : : : : : : : : : :");
            Logger.Info(": : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :");
            Console.WriteLine(": : : : : Encrypt / Decrypt Test : : : : :");
            // Initializes the Autofac DiContainer
            DiContainer.Initialize();
            // Used to build the container for consumption
            var container = DiContainer.builder.Build();

            Console.Write("Input String to Encrypt:  ");
            var Data = Console.ReadLine();

            Logger.Info($"Input String to Encrypt:  {Data}");
            // Accessing container to build object from encryption service
            var EncryptedData = container.Resolve <Business.Encryption.Encrypt.IEncrypt>().RijndaelEncryption(
                ConfigurationManager.AppSettings["SecretKey"],
                ConfigurationManager.AppSettings["Salt"],
                Data);

            Console.WriteLine($"Encrypted String : {EncryptedData}");
            Logger.Info($"Encrypted String : {EncryptedData}");
            // Encode encryted string
            var EncodedString = container.Resolve <Business.Encryption.Encoding.IConversions>().StringToHexConversion8(EncryptedData);

            Console.WriteLine($"Encoded String : {EncodedString}");
            Logger.Info($"Encoded String : {EncodedString}");
            // Decode encypted string
            var DecodedString = container.Resolve <Business.Encryption.Encoding.IConversions>().HexToStringConversion8(EncodedString);

            Console.WriteLine($"Decoded String : {DecodedString}");
            Logger.Info($"Decoded String : {DecodedString}");
            // Accessing container to build object from encryption service
            var DecryptedData = container.Resolve <Business.Encryption.Decrypt.IDecrypt>().RijndaelDecryption(
                ConfigurationManager.AppSettings["SecretKey"],
                ConfigurationManager.AppSettings["Salt"],
                DecodedString);

            Console.WriteLine($"Decrypted String : {DecryptedData}");
            Logger.Info($"Decrypted String : {DecryptedData}");
            Logger.Info(": : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : :");
            Console.WriteLine("Press any key when done...");
            Console.ReadLine();
        }
Пример #3
0
        static void Execute()
        {
            // Initializes the Autofac DiContainer
            var container = DiContainer.DiContainer.Initialize();
            // Implements Container
            var messageManager = container.Resolve <Bll.MessageManager.IMessage>().setMessage(container.Resolve <Configuration.ISettings>().ConfigMessage);
            var outputMessage  = container.Resolve <Bll.MessageManager.IMessage>().getMessage(messageManager);
            var buildVersion   = container.Resolve <Bll.BuildInformation.IBuildData>().setBuidInformation(System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(),
                                                                                                          System.Convert.ToDateTime(Properties.Resources.BuildDate).ToString());

            //var messageManager = MessageManager.setMessage(settings.ConfigMessage);
            //var outputMessage = MessageManager.getMessage(messageManager);
            //BuildManager.setBuidInformation(System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(),
            //    System.Convert.ToDateTime(Properties.Resources.BuildDate).ToString());
            //var buildVersion = BuildManager.version;
            System.Console.WriteLine(outputMessage);
            Logger.Debug($"Ouput Message : {outputMessage}");
            System.Console.WriteLine($"Build Version: {buildVersion.BuildVersion}");
            Logger.Debug($"Build Version: {buildVersion.BuildVersion}");
            System.Console.WriteLine($"Build Date: {buildVersion.BuildDate}");
            Logger.Debug($"Build Date: {buildVersion.BuildDate}");
            System.Console.WriteLine("Press any key to continue...");
            System.Console.ReadLine();
        }
Пример #4
0
 static void Main(string[] args)
 {
     Logger.Info(": : : : : Starting : : : : : ");
     Execute();
 }
Пример #5
0
 static void Main(string[] args)
 {
     Console.WriteLine(": : : : : Test Logger Example : : : : :");
     Log.Info("This is a test");
     Log.Xml("Who has a Jenny Butt!");
 }