コード例 #1
0
        public static List <AppHomeFolder.CreationResults> BootstrapWrapperForTests()
        {
            String v_PathToStandardFolder = Environment.GetFolderPath(
                Environment.SpecialFolder.ApplicationData)
                                            + Path.DirectorySeparatorChar
                                            + VersionWrapper.NameCalling
                                            + "Test"
                                            + Path.DirectorySeparatorChar;

            AppHomeFolder.CreationResults v_Result = AppHomeFolder.TestAndCreateHomeFolder(v_PathToStandardFolder);
            List <String> v_FilesToCopy            = new List <string>()
            {
                "log4netConfig", "TestEmptyDbPlayer.xml"
            };
            List <AppHomeFolder.CreationResults> v_ResultsFromResourceCopy = AppHomeFolder.CopyStaticResources(v_FilesToCopy, v_PathToStandardFolder);

            Console.WriteLine("BootstrapWrapperForTests results:");

            foreach (AppHomeFolder.CreationResults i_Result in v_ResultsFromResourceCopy)
            {
                Console.WriteLine("  * " + i_Result);
            }

            XmlConfigurator.Configure(new FileInfo(v_PathToStandardFolder + "log4netConfig"));
            LogManager.GetLogger("BootstrapWrapperForTests").Info("BootstrapWrapperForTests successfully started the logger.");


            return(new List <AppHomeFolder.CreationResults> {
                AppHomeFolder.CreationResults.Error
            });
        }
コード例 #2
0
        /// <summary>
        /// This function will create %APPDATA%\ProductName and copy the logging configuration if it does not exist.
        /// </summary>
        /// <returns>A AppHomeFolder.CreationResults element. Copied if the file was not in the expected folder,
        /// Exists if the file was already there and Error if something went wrong.</returns>
        public static List <AppHomeFolder.CreationResults> BootstrapWrapper()
        {
            String v_PathToStandardFolder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
                                            + Path.DirectorySeparatorChar
                                            + VersionWrapper.NameCalling
                                            + Path.DirectorySeparatorChar;

            AppHomeFolder.CreationResults v_Result = AppHomeFolder.TestAndCreateHomeFolder(v_PathToStandardFolder);
            List <String> v_FilesToCopy            = new List <string>()
            {
                "log4netConfig", "bgldb.xml", "DemoDB.xml"
            };
            List <AppHomeFolder.CreationResults> v_ResultsFromResourceCopy = AppHomeFolder.CopyStaticResources(v_FilesToCopy, v_PathToStandardFolder);

            Console.WriteLine("BootstrapWrapper result: " + v_ResultsFromResourceCopy[0]);
            XmlConfigurator.Configure(new FileInfo(v_PathToStandardFolder + "log4netConfig"));
            LogManager.GetLogger("StandardFileBootstrapper").Info("Bootstrapper successfully started the logger: " + v_ResultsFromResourceCopy[0]);

            return(v_ResultsFromResourceCopy);
        }