示例#1
0
        /** ****************************************************************************************
         * This method must (may) be called prior to using the ALox library, e.g. at the beginning of
         * the main() method of an application. It is OK, to call this method more than once, which
         * allows independent code blocks (e.g. libraries) to bootstrap ALox without interfering.
         * But only the first call is effective and may be used to set the command line arguments
         * as configuration plug-in.
         *
         * In the C# version of the AWorx library, the invocation of this method is optional.
         * However, it is good practice to invoke this method in the main() method of a process
         * and provide the command line arguments. See \ref cs::aworx::lib::ALIB::Init "ALIB.Init"
         * for more information on the configuration parameters.
         *
         *  @param useEnv  If true, a
         *                 \ref cs::aworx::lib::config::EnvironmentPlugIn "EnvironmentPlugIn"
         *                 is attached to the
         *                 \ref cs::aworx::lib::ALIB::Config "ALIB.Config" singleton. Hence,
         *                 environment variables are read and potentially overwrite
         *                 configuration variables in other configuration plug-ins.<br>
         *                 Defaults to true.
         *  @param args    Parameter which in the standard case is taken from  C/C++ main()
         *                 method providing the command line arguments.
         *                 If arguments are provided, a
         *                 \ref cs::aworx::lib::config::CommandLinePlugIn "CommandLinePlugIn"
         *                 is attached to the
         *                 \ref cs::aworx::lib::ALIB::Config "ALIB.Config" singleton. Hence,
         *                 command line options are read and those potentially overwrite
         *                 configuration variables in other configuration plug-ins.<br>
         *                 Defaults to null.
         ******************************************************************************************/
        public static void     Init(bool useEnv = true, String[] args = null)
        {
            if (isInitialized)
            {
                return;
            }
            isInitialized = true;

            // initialize ALIB
            ALIB.Init(useEnv, args);
        }
        // #############################################################################################
        // static entrance (Main)
        // #############################################################################################
        static void Main(string[] args)
        {
            ALIB.Init(true, args);


            // create us
            AloxSamples samples = new AloxSamples();

            // do some release logging tests.
            Console.WriteLine("PRINT: Debug logging:");
            samples.DebugLogging();
            ALoxSampleReset();

            // do some release logging tests.
            Console.WriteLine("PRINT: Release logging:");
            samples.ReleaseLogging();
            ALoxSampleReset();

            // do some performance tests.
            Console.WriteLine("PRINT: Performance test (debug logging):");
            samples.PerformanceTest();
            ALoxSampleReset();

            // do some performance tests.
            Console.WriteLine("PRINT: Performance test (release logging):");
            samples.PerformanceTestRL();
            ALoxSampleReset();

            // test class TextFileLogger
            Console.WriteLine("PRINT: test class TextFileLogger:");
            samples.TextFileLogger();
            ALoxSampleReset();

            // test class terminal test (colors and styles)
            Console.WriteLine("PRINT: Colors (depending on detected terminal):");
            samples.ColorTest();
            ALoxSampleReset();

            Console.WriteLine("PRINT: Thats it!");

            // sample ALib report facility through ALox
            samples.SampleALibReport();

            ALIB.TerminationCleanUp();
        }